@Override
 public Role updateRole(Role r) {
   //        Set<OwnerPermission> newPermissions = new HashSet<OwnerPermission>();
   //        for (OwnerPermission incomingPerm : r.getPermissions()) {
   //            newPermissions.add(this.permCurator.findOrCreate(
   //                incomingPerm.getOwner(), incomingPerm.getAccess()));
   //        }
   //        r.getPermissions().clear();
   //        r.getPermissions().addAll(newPermissions);
   return roleCurator.merge(r);
 }
Ejemplo n.º 2
0
  @Before
  public void setUp() {
    owner = ownerCurator.create(new Owner(OWNER_NAME));

    Role ownerAdminRole = createAdminRole(owner);
    roleCurator.create(ownerAdminRole);

    User user = new User("testing user", "pass");
    principal =
        new UserPrincipal(
            "testing user",
            new ArrayList<Permission>(
                permFactory.createPermissions(user, ownerAdminRole.getPermissions())),
            false);
    setupPrincipal(principal);

    ConsumerType ueberCertType = new ConsumerType(ConsumerTypeEnum.UEBER_CERT);
    consumerTypeCurator.create(ueberCertType);

    or =
        new OwnerResource(
            ownerCurator,
            null,
            consumerCurator,
            i18n,
            null,
            null,
            null,
            null,
            null,
            poolManager,
            null,
            null,
            null,
            null,
            consumerTypeCurator,
            entCertCurator,
            entitlementCurator,
            ueberCertGenerator,
            null,
            null,
            contentOverrideValidator,
            serviceLevelValidator,
            null,
            null,
            null,
            productManager,
            contentManager);
  }
 @Override
 public List<Role> listRoles() {
   return roleCurator.listAll();
 }
 @Override
 public void removeUserFromRole(Role role, User user) {
   role.removeUser(user);
   roleCurator.merge(role);
 }
 @Override
 public void addUserToRole(Role role, User user) {
   role.addUser(user);
   roleCurator.merge(role);
 }
 @Override
 public Role getRole(String roleId) {
   return roleCurator.find(roleId);
 }
 @Override
 public void deleteRole(String roleId) {
   Role r = roleCurator.find(roleId);
   roleCurator.delete(r);
 }