Package domain

Examples of domain.Role


      return new Response(ResponseStatus.FAIL, "No authorization");
    }
   
    try
     
      Role newRoleObject = (Role) databaseSession.createCriteria(Role.class).add(Restrictions.eq("id", this.role)).uniqueResult();
     
      if (null == newRoleObject) {
       
        return new Response(ResponseStatus.FAIL, "User role does not exist, database failure.");
      }
View Full Code Here


      // get permission types from database (very very dumb):
      PermissionType publicPermission = (PermissionType) databaseSession.get(PermissionType.class, new Long(1));
     
      // get admin role, yep, dumb as well.
      Role adminRole = (Role) databaseSession.get(Role.class, new Long(2));
     
      // who can edit the event:
      // 1. the owner
      // 2. Not owner but admin if the event is public
      if ( !(oldEvent.getId().getOwner().equals(currentUser)
View Full Code Here

      return new Response(ResponseStatus.FAIL, "No authorization");
    }
   
   
    try {
      Role userRole = (Role) databaseSession.createCriteria(Role.class).add(Restrictions.eq("id", this.role)).uniqueResult();
     
      if (null == userRole) {
        return new Response(ResponseStatus.FAIL, "User role does not exist, database failure.");
      }
     
View Full Code Here

       
        // get permission types from database (very very dumb):
        PermissionType publicPermission = (PermissionType) databaseSession.get(PermissionType.class, new Long(1));
       
        // get admin role, yep, dumb as well.
        Role adminRole = (Role) databaseSession.get(Role.class, new Long(2));
       
        // who can edit the event:
        // 1. the owner
        // 2. Not owner but admin if the event is public
        if ( !eventObject.getId().getOwner().equals(currentUser)
View Full Code Here

    EventType eventType7 = new EventType();
    eventType7.setColor("#FFFF00"); // Yellow
    eventType7.setDescription("Other");
   
    // load initial roles
    Role role1 = new Role();
    role1.setDescription("User");
   
    Role role2 = new Role();
    role2.setDescription("Admin");
   
    // load initial permission-types
    PermissionType permissionType1 = new PermissionType();
    permissionType1.setDescription("Public");
   
View Full Code Here

    }
   
    try {
      // wow, how unnecessary is to store roles in the database...
      Criteria userRoleCriteria = databaseSession.createCriteria(Role.class).add(Restrictions.eq("description", "User"));
      Role userRole = (Role) userRoleCriteria.uniqueResult();
     
      if (userRole == null) {
        return new Response(ResponseStatus.FAIL, "User role does not exist, database failure.");
      }
     
View Full Code Here

    // get permission types from database (very very dumb):
    PermissionType privatePermission = (PermissionType) databaseSession.get(PermissionType.class, new Long(3));
    PermissionType protectedPermission = (PermissionType) databaseSession.get(PermissionType.class, new Long(2));

    // get admin role, yep, dumb as well.
    Role adminRole = (Role) databaseSession.get(Role.class, new Long(2));
   
    // Remove sensitive information
    for(Event event : events) {
      // remove password from user anyway
      event.getId().getOwner().setPassword(null);
View Full Code Here

      RoleAdminApi roleApi = roleAdminOption.get();
      Set<? extends Role> roles = roleApi.list().toSet();
      assertNotNull(roles);
      assertFalse(roles.isEmpty());
      for (Role role : roles) {
         Role aRole = roleApi.get(role.getId());
         assertEquals(aRole, role);
      }

   }
View Full Code Here

   }

   @Test(dependsOnMethods = { "testCreateRole" })
   public void testGetRole() {

      Role testGetRole = roleAdminOption.get().get(testRole.getId());
      assertNotNull(testGetRole);
      assertEquals(testGetRole.getName(), "jclouds-test-role");

   }
View Full Code Here

            stringFromResource("/role_create_response.json"))));

      try {
         KeystoneApi keystoneApi = api(server.getUrl("/").toString(), "openstack-keystone");
         RoleAdminApi roleAdminApi = keystoneApi.getRoleAdminApi().get();
         Role testRole = roleAdminApi.create("jclouds-role");

         assertNotNull(testRole);
         assertEquals(testRole.getId(), "r1000");

         assertEquals(server.getRequestCount(), 3);
         assertAuthentication(server);
         assertExtensions(server);
         RecordedRequest createRoleRequest = server.takeRequest();
View Full Code Here

TOP

Related Classes of domain.Role

Copyright © 2018 www.massapicom. 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.