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

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


    readerRole.addRule(ODatabaseSecurityResources.ALL_CLASSES, ORole.PERMISSION_READ);
    readerRole.addRule(ODatabaseSecurityResources.ALL_CLUSTERS, ORole.PERMISSION_READ);
    readerRole.addRule(ODatabaseSecurityResources.QUERY, ORole.PERMISSION_READ);
    readerRole.addRule(ODatabaseSecurityResources.COMMAND, ORole.PERMISSION_READ);
    readerRole.addRule(ODatabaseSecurityResources.RECORD_HOOK, ORole.PERMISSION_READ);
    readerRole.save();
    metadata.getSecurity().createUser("reader", "reader", new String[] { readerRole.getName() });

    final ORole writerRole = metadata.getSecurity().createRole("writer", ORole.ALLOW_MODES.DENY_ALL_BUT);
    writerRole.addRule(ODatabaseSecurityResources.DATABASE, ORole.PERMISSION_READ);
    writerRole
View Full Code Here


    writerRole.addRule(ODatabaseSecurityResources.ALL_CLASSES, ORole.PERMISSION_ALL);
    writerRole.addRule(ODatabaseSecurityResources.ALL_CLUSTERS, ORole.PERMISSION_ALL);
    writerRole.addRule(ODatabaseSecurityResources.QUERY, ORole.PERMISSION_READ);
    writerRole.addRule(ODatabaseSecurityResources.COMMAND, ORole.PERMISSION_ALL);
    writerRole.addRule(ODatabaseSecurityResources.RECORD_HOOK, ORole.PERMISSION_ALL);
    writerRole.save();
    metadata.getSecurity().createUser("writer", "writer", new String[] { writerRole.getName() });
  }
}
View Full Code Here

  @Test(dependsOnMethods = "testReaderCannotSeeWriterDocumentAgain")
  public void testReaderRoleInheritsFromWriterRole() throws IOException {
    database.open("admin", "admin");
    ORole reader = database.getMetadata().getSecurity().getRole("reader");
    reader.setParentRole(database.getMetadata().getSecurity().getRole("writer"));
    reader.save();
  }

  @Test(dependsOnMethods = "testReaderRoleInheritsFromWriterRole")
  public void testWriterRoleCanSeeWriterDocument() throws IOException {
    database.open("writer", "writer");
View Full Code Here

  @Test(dependsOnMethods = "testReaderRoleCanSeeInheritedDocument")
  public void testReaderRoleDesntInheritsFromWriterRole() throws IOException {
    database.open("admin", "admin");
    ORole reader = database.getMetadata().getSecurity().getRole("reader");
    reader.setParentRole(null);
    reader.save();
  }

  /**** END TEST FOR #1980: Record Level Security: permissions don't follow role's inheritance ****/

  @Test(dependsOnMethods = "testReaderRoleDesntInheritsFromWriterRole")
View Full Code Here

   
    reader.getDocument().field(RoleService.FIELD_INTERNAL,true);
    reader.getDocument().field(RoleService.FIELD_MODIFIABLE,false);
    reader.getDocument().field(RoleService.FIELD_DESCRIPTION,DefaultRoles.BASE_READER.getDescription())
    reader.getDocument().field(RoleService.FIELD_ASSIGNABLE,DefaultRoles.BASE_READER.isAssignable());
    reader.save();
   
    Logger.info("writer");;
    ORole regRole = RoleDao.getRole("registereduser");
    ORole writer = RoleDao.createRole(DefaultRoles.BASE_WRITER.toString(), regRole.getMode(),regRole.getRules());
    writer.getDocument().field(RoleService.FIELD_INTERNAL,true);
View Full Code Here

    ORole writer = RoleDao.createRole(DefaultRoles.BASE_WRITER.toString(), regRole.getMode(),regRole.getRules());
    writer.getDocument().field(RoleService.FIELD_INTERNAL,true);
    writer.getDocument().field(RoleService.FIELD_MODIFIABLE,false);
    writer.getDocument().field(RoleService.FIELD_DESCRIPTION,DefaultRoles.BASE_WRITER.getDescription())
    writer.getDocument().field(RoleService.FIELD_ASSIGNABLE,DefaultRoles.BASE_WRITER.isAssignable());
    writer.save();
  }
 
  private void updateOldRoles(){
    Logger.info("Updating old roles");
    Logger.info("anonymoususer");
View Full Code Here

    anonymRole.getDocument().field(RoleService.FIELD_MODIFIABLE,false);
    anonymRole.getDocument().field(RoleService.FIELD_DESCRIPTION,DefaultRoles.ANONYMOUS_USER.getDescription())
    anonymRole.getDocument().field(RoleService.FIELD_ASSIGNABLE,DefaultRoles.ANONYMOUS_USER.isAssignable());
    anonymRole.getDocument().field(RoleDao.FIELD_INHERITED,RoleDao.getRole(DefaultRoles.ANONYMOUS_USER.getInheritsFrom()).getDocument().getRecord());
    anonymRole.getDocument().field("name",DefaultRoles.ANONYMOUS_USER.toString());
    anonymRole.save();
    anonymRole=null;
   
    Logger.info("registered");
    ORole regRole = RoleDao.getRole("registereduser");
    regRole.getDocument().field(RoleService.FIELD_INTERNAL,true);
View Full Code Here

    regRole.getDocument().field(RoleService.FIELD_MODIFIABLE,false);
    regRole.getDocument().field(RoleService.FIELD_DESCRIPTION,DefaultRoles.REGISTERED_USER.getDescription())
    regRole.getDocument().field(RoleService.FIELD_ASSIGNABLE,DefaultRoles.REGISTERED_USER.isAssignable());
    regRole.getDocument().field(RoleDao.FIELD_INHERITED,RoleDao.getRole(DefaultRoles.REGISTERED_USER.getInheritsFrom()).getDocument().getRecord());
    regRole.getDocument().field("name",DefaultRoles.REGISTERED_USER.toString());
    regRole.save();
    regRole=null;
   
    Logger.info("backofficeuser");
    ORole backRole = RoleDao.getRole("backofficeuser");
    backRole.getDocument().field(RoleService.FIELD_INTERNAL,true);
View Full Code Here

    backRole.getDocument().field(RoleService.FIELD_DESCRIPTION,DefaultRoles.BACKOFFICE_USER.getDescription())
    backRole.getDocument().field(RoleService.FIELD_ASSIGNABLE,DefaultRoles.BACKOFFICE_USER.isAssignable());
    backRole.getDocument().field(RoleDao.FIELD_INHERITED,RoleDao.getRole(DefaultRoles.BACKOFFICE_USER.getInheritsFrom()).getDocument().getRecord());
    backRole.addRule(ODatabaseSecurityResources.BYPASS_RESTRICTED, ORole.PERMISSION_ALL);
    backRole.getDocument().field("name",DefaultRoles.BACKOFFICE_USER.toString());
    backRole.save();
    backRole=null;
   
    Logger.info("administrator");
    //retrieves the "old" admin role
    ORole oldAdminRole = RoleDao.getRole("admin");
View Full Code Here

    adminRole.getDocument().field(RoleDao.FIELD_INHERITED,(ORecord)null);
    oldAdminRole.addRule(ODatabaseSecurityResources.BYPASS_RESTRICTED, ORole.PERMISSION_ALL);
    adminRole.getDocument().field("name",DefaultRoles.BASE_ADMIN.toString());

    oldAdminRole.save();
    adminRole.save();
    oldAdminRole.getDocument().field(RoleDao.FIELD_INHERITED,adminRole.getDocument().getRecord());
    oldAdminRole.getDocument().field("name",DefaultRoles.ADMIN.toString());
    oldAdminRole.save();
   
    //update the "friend_of" roles
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.