Package com.orientechnologies.orient.core.metadata.security

Examples of com.orientechnologies.orient.core.metadata.security.ORole.save()


    public static ORole createRole(String name,String inheritedRoleName){
      ODatabaseRecordTx db = DbHelper.getConnection();
      ORole inheritedRole = db.getMetadata().getSecurity().getRole(inheritedRoleName);
      final ORole role =  db.getMetadata().getSecurity().createRole(name,inheritedRole.getMode());
      role.getDocument().field(FIELD_INHERITED,inheritedRole.getDocument().getRecord());
      role.save();
          return role;
    }
   
    public static ORole createRole(String name,ORole.ALLOW_MODES mode,Map rules){
      ODatabaseRecordTx db = DbHelper.getConnection();
View Full Code Here


   
    public static ORole createRole(String name,ORole.ALLOW_MODES mode,Map rules){
      ODatabaseRecordTx db = DbHelper.getConnection();
      final ORole role =  db.getMetadata().getSecurity().createRole(name,mode);
      role.getDocument().field("rules",rules);
      role.save();
          return role;
    }
   

View Full Code Here

    ORole newRole = RoleDao.createRole(name, inheritedRole);
    newRole.getDocument().field(FIELD_INTERNAL,false);
    newRole.getDocument().field(FIELD_MODIFIABLE,true);
    newRole.getDocument().field(FIELD_DESCRIPTION,description);
    newRole.getDocument().field(FIELD_ASSIGNABLE,true);
    newRole.save();
  }
 
  public static void createInternalRoles(){
    for (DefaultRoles r : DefaultRoles.values()){
      ORole newRole;
View Full Code Here

      newRole.getDocument().field(FIELD_MODIFIABLE,false);
      newRole.getDocument().field(FIELD_DESCRIPTION,r.getDescription())
      newRole.getDocument().field(FIELD_ASSIGNABLE,r.isAssignable());
      if (r==DefaultRoles.BACKOFFICE_USER) newRole.addRule(ODatabaseSecurityResources.BYPASS_RESTRICTED, ORole.PERMISSION_ALL);
      if (r==DefaultRoles.ADMIN) newRole.addRule(ODatabaseSecurityResources.BYPASS_RESTRICTED, ORole.PERMISSION_ALL);
      newRole.save();
    }

  }

  public static List<ODocument> getRoles() throws SqlInjectionException {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.