use of org.apache.directory.fortress.core.model.Role in project directory-fortress-core by apache.
the class AdminMgrConsole method revokePermission.
void revokePermission(boolean isRole) {
try {
ReaderUtil.clearScreen();
System.out.println("Enter perm object");
String object = ReaderUtil.readLn();
System.out.println("Enter perm operation");
String operation = ReaderUtil.readLn();
Permission pOp = new Permission(object, operation);
String name;
if (isRole) {
System.out.println("Enter role name");
name = ReaderUtil.readLn();
am.revokePermission(pOp, new Role(name));
} else {
System.out.println("Enter userId");
name = ReaderUtil.readLn();
am.revokePermission(pOp, new User(name));
}
System.out.println("perm object [" + object + "] operation [" + operation + "] has been granted to [" + name + "]");
System.out.println("has been revoked.");
System.out.println("ENTER to continue");
} catch (SecurityException e) {
LOG.error("revokePermission caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
use of org.apache.directory.fortress.core.model.Role in project directory-fortress-core by apache.
the class AdminMgrConsole method addRoleAscendant.
/**
*/
void addRoleAscendant() {
try {
Role cre = new Role();
Role pre = new Role();
ReaderUtil.clearScreen();
System.out.println("Enter child role name:");
cre.setName(ReaderUtil.readLn());
System.out.println("Enter parent role name to add to repo:");
pre.setName(ReaderUtil.readLn());
System.out.println("Enter parent role description:");
pre.setDescription(ReaderUtil.readLn());
am.addAscendant(cre, pre);
System.out.println("child role [" + cre.getName() + "]");
System.out.println("parent role [" + pre.getName() + "]");
System.out.println("parent role and inheritance relationship has been added");
System.out.println("ENTER to continue");
} catch (SecurityException e) {
LOG.error("addRoleAscendant caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
use of org.apache.directory.fortress.core.model.Role in project directory-fortress-core by apache.
the class AdminMgrConsole method addRole.
void addRole() {
Role re = new Role();
try {
ReaderUtil.clearScreen();
System.out.println("Enter role name:");
re.setName(ReaderUtil.readLn());
System.out.println("Enter Role's description field");
re.setDescription(ReaderUtil.readLn());
Role re2 = am.addRole(re);
System.out.println("name [" + re2.getName() + "]");
System.out.println("internalId [" + re2.getId() + "]");
System.out.println("name description [" + re2.getDescription() + "]");
System.out.println("has been added");
System.out.println("ENTER to continue");
} catch (SecurityException e) {
LOG.error("addRole caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
use of org.apache.directory.fortress.core.model.Role in project directory-fortress-core by apache.
the class AdminMgrConsole method removeRoleInheritance.
/**
*/
void removeRoleInheritance() {
try {
Role cre = new Role();
Role pre = new Role();
ReaderUtil.clearScreen();
System.out.println("Enter child role name:");
cre.setName(ReaderUtil.readLn());
System.out.println("Enter parent role name:");
pre.setName(ReaderUtil.readLn());
am.deleteInheritance(pre, cre);
System.out.println("child role [" + cre.getName() + "]");
System.out.println("parent role [" + pre.getName() + "]");
System.out.println("inheritance relationship has been removed");
System.out.println("ENTER to continue");
} catch (SecurityException e) {
LOG.error("removeRoleInheritance caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
use of org.apache.directory.fortress.core.model.Role in project directory-fortress-core by apache.
the class DelegatedAccessMgrConsole method canAssign.
/**
*/
void canAssign() {
try {
ReaderUtil.clearScreen();
System.out.println("Enter userId:");
User user = new User(ReaderUtil.readLn());
System.out.println("Enter role name:");
Role role = new Role(ReaderUtil.readLn());
boolean result = dAmgr.canAssign(session, user, role);
System.out.println("Can Assign User [" + user.getUserId() + "] Role [" + role.getName() + "] return [" + result + "]");
System.out.println("ENTER to continue");
} catch (SecurityException e) {
LOG.error("canAssign caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
Aggregations