Package org.jclouds.openstack.keystone.v2_0.domain

Examples of org.jclouds.openstack.keystone.v2_0.domain.Role$ConcreteBuilder


      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

      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/admin_extensions.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(201).setBody(
            stringFromResource("/user_create_response.json"))));

      try {
         KeystoneApi keystoneApi = api(server.getUrl("/").toString(), "openstack-keystone");
         UserAdminApi userAdminApi = keystoneApi.getUserAdminApi().get();
         CreateUserOptions createUserOptions = CreateUserOptions.Builder.email("john.smith@example.org").enabled(true);
         User testUser = userAdminApi.create("jqsmith", "jclouds-password", createUserOptions);

         assertNotNull(testUser);
         assertEquals(testUser.getId(), "u1000");
View Full Code Here

      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access_version_uids.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/admin_extensions.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404)));

      try {
         KeystoneApi keystoneApi = api(server.getUrl("/").toString(), "openstack-keystone");
         UserAdminApi userAdminApi = keystoneApi.getUserAdminApi().get();
         CreateUserOptions createUserOptions = CreateUserOptions.Builder.email("john.smith@example.org").enabled(true);
         User testUser = userAdminApi.create("jqsmith", "jclouds-password", createUserOptions);

         assertNull(testUser);
View Full Code Here

      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/admin_extensions.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(200).setBody(
            stringFromResource("/user_update_response.json"))));

      try {
         KeystoneApi keystoneApi = api(server.getUrl("/").toString(), "openstack-keystone");
         UserAdminApi userAdminApi = keystoneApi.getUserAdminApi().get();
         UpdateUserOptions updateUserOptions = UpdateUserOptions.Builder.email("john.smith.renamed@example.org")
               .enabled(false).name("jqsmith-renamed").password("jclouds-password");
         User updatedUser = userAdminApi.update("u1000", updateUserOptions);

         assertNotNull(updatedUser);
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.keystone.v2_0.domain.Role$ConcreteBuilder

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.