/** * Derived classes can override createRole() to return an extended ORole implementation or null if the role should not be added. */ protected ORole createRole(final ODocument roleDoc) { return new ORole(roleDoc); }
public ORole createRole(final String iRoleName, final ORole iParent, final ORole.ALLOW_MODES iAllowMode) { final ORole role = new ORole(iRoleName, iParent, iAllowMode); return role.save(); }
public ORole getRole(final String iRoleName) { if (iRoleName == null) return null; final List<ODocument> result = getDatabase().<OCommandRequest>command( new OSQLSynchQuery<ODocument>("select from ORole where name = ? limit 1")).execute(iRoleName); if (result != null && !result.isEmpty()) return new ORole(result.get(0)); return null; }
public ORole getRole(final OIdentifiable iRole) { final ODocument doc = iRole.getRecord(); if (doc != null) { OClass clazz = doc.getSchemaClass(); if (clazz != null && clazz.isSubClassOf("ORole")) { return new ORole(doc); } } return null; }
private void assignSchemaFeature(OrienteerWebApplication app, ODatabaseDocument db) { for(ODocument oRoleDoc : db.getMetadata().getSecurity().getAllRoles()) { ORole oRole = new ORole(oRoleDoc); if(oRole.getParentRole()==null) { oRole.grant(OSecurityHelper.FEATURE_RESOURCE, SchemaPage.SCHEMA_FEATURE, OrientPermission.READ.getPermissionFlag()); oRole.grant(OSecurityHelper.FEATURE_RESOURCE, SearchPage.SEARCH_FEATURE, OrientPermission.READ.getPermissionFlag()); oRole.save(); } } }