Commit 24e45bc1 authored by Jonathan Shahen's avatar Jonathan Shahen

Init; beginning of the skeleton code

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Mohawk-T Conversion Tool</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
# everything after a hash tag, until the newline, is considered a comment and ignored
# white space is ignored, this includes tabs and spaces and newline characters
# You can put as much white space anywhere and it will be ignored
# control chain: remove comments -> remove whitespace -> parse text into internal structure -> convert
# The order of the document doesn't matter: MaxRoles can be last, first, or somewhere in the middle and same goes for all the others
MaxRoles: 15 # roles count from 0 to MaxRoles - 1; represented below with 'role0' (without quotes, and the 0 can be replaced with any number in the appropriate range)
MaxTimeSlots: 10 # time slots count from 0 to MaxTimeSlots - 1; represented below with 't0' (without quotes, and the 0 can be replaced with any number in the appropriate range)
CanAssign {
#<Admin role, starting timeslot - end timeslot for admin role, role preconditions, [time slot rule gives role to user for, another time slot (optional)...],role to give to the user>
<role0,t0-t5,TRUE,[t1,t1],role1> #(1)
<role0,t0-t0,role1 & NOT role2 & role3,[t1,t2],role2> #(2)
}
CanRevoke {
# same as above
}
CanEnable {
# same as above
}
CanDisable {
# same as above
}
# Query: timeslot to check, [set of roles that the user must have in the timeslot (no NOTs allowed)]
Query: t0,[role1,role0,role2]
\ No newline at end of file
package mohawk;
public class ConvertToRBAC {
}
package mohawk;
public class ConvertToRanise {
}
package mohawk;
public class ConvertToUzun {
}
package mohawk;
public class Converter {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
package mohawk;
public class Parser {
}
package pieces;
public class CanAssign extends CanBlock {
public static String _PATTERN = "[]";
public CanAssign() {
super();
pattern = _PATTERN;
}
}
package pieces;
import java.util.ArrayList;
public class CanBlock {
protected ArrayList<Rule> rules = new ArrayList<Rule>();
protected String pattern = "";
public int size() {
return rules.size();
}
public String getPattern() {
return pattern;
}
public ArrayList<Rule> getRules() {
return rules;
}
public Rule[] getRulesArray() {
return rules.toArray(new Rule[size()]);
}
}
package pieces;
public class CanDisable extends CanBlock {
public static String _PATTERN = "[]";
public CanDisable() {
super();
pattern = _PATTERN;
}
}
package pieces;
public class CanEnable extends CanBlock {
public static String _PATTERN = "[]";
public CanEnable() {
super();
pattern = _PATTERN;
}
}
package pieces;
public class CanRevoke extends CanBlock {
public static String _PATTERN = "[]";
public CanRevoke() {
super();
pattern = _PATTERN;
}
}
package pieces;
public class Role {
public static String _prefix = "role";
public Integer _name;
public Boolean _not;
public Role(Integer name, Boolean not) {
this._name = name;
this._not = not;
}
@Override
public String toString() {
if (_not == false) {
return _prefix + _name;
} else {
return "NOT " + _prefix + _name;
}
}
}
package pieces;
import java.io.IOException;
import java.util.ArrayList;
public class Rule {
public RuleType _type;
public Role _adminRole;
public Integer[] _adminTimeSlots = new Integer[2];
public ArrayList<Role> _preconditions = new ArrayList<Role>();
public ArrayList<Integer> _roleSchedule = new ArrayList<Integer>();
public Role _role;
public Rule() {
}
public void parse(String input) throws IOException {
}
@Override
public String toString() {
StringBuffer s = new StringBuffer();
s.append(_type + " <");
return s.toString();
}
}
package pieces;
public enum RuleType {
ASSIGN, DISABLE, ENABLE, REVOKE
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment