@Test void testUpdatePermission() { setUser(); ObjectIdentity objectIdentity = new ObjectIdentityImpl("type", "identifier"); Sid sid = new PrincipalSid("user"); MutableAcl acl = mock(MutableAcl.class); when(acl.getOwner()).thenReturn(sid); when(mutableAclService.readAclById(objectIdentity)).thenReturn(acl); when(mutableAclClassService.getAclClassTypes()).thenReturn(singletonList("type")); Permission permission = Permission.create(objectIdentity, sid, PermissionSet.WRITE); permissionServiceDecorator.updatePermission(permission); verify(permissionService).updatePermission(permission); resetContext(); }
@Override public void updatePermission(Permission permission) { checkForSu(permission.getSid()); checkSuOrOwner(permission.getObjectIdentity()); permissionService.updatePermission(permission); }
PermissionServiceDecorator implements PermissionService { @Override public void updatePermission(Permission permission) { checkForSu(permission.getSid()); checkSuOrOwner(permission.getObjectIdentity()); permissionService.updatePermission(permission); } }
PermissionServiceDecorator implements PermissionService { @Override public void updatePermission(Permission permission) { checkForSu(permission.getSid()); checkSuOrOwner(permission.getObjectIdentity()); permissionService.updatePermission(permission); } PermissionServiceDecorator(
      PermissionService permissionService,
      EntityHelper entityHelper,
      UserRoleTools userRoleTools,
      MutableAclService mutableAclService,
      MutableAclClassService mutableAclClassService,
      UserPermissionEvaluator userPermissionEvaluator); }
PermissionServiceDecorator implements PermissionService { @Override public void updatePermission(Permission permission) { checkForSu(permission.getSid()); checkSuOrOwner(permission.getObjectIdentity()); permissionService.updatePermission(permission); } PermissionServiceDecorator(
      PermissionService permissionService,
      EntityHelper entityHelper,
      UserRoleTools userRoleTools,
      MutableAclService mutableAclService,
      MutableAclClassService mutableAclClassService,
      UserPermissionEvaluator userPermissionEvaluator); @Override Set<LabelledType> getLabelledTypes(); @Override Set<LabelledPermission> getPermissionsForObject(
      ObjectIdentity objectIdentity, Set<Sid> sids, boolean isReturnInheritedPermissions); @Override void createAcl(ObjectIdentity objectIdentity); @Override void createPermission(Permission permission); @Override void createPermissions(Set<Permission> permissions); @Override void updatePermission(Permission permission); @Override void updatePermissions(Set<Permission> permissions); @Override void deletePermission(Sid sid, ObjectIdentity objectIdentity); @Override void addType(String typeId); @Override void deleteType(String typeId); @Override Map<String, Set<LabelledPermission>> getPermissionsForType(
      String typeId, Set<Sid> sids, boolean isReturnInherited); @Override Map<String, Set<LabelledPermission>> getPermissionsForType(
      String typeId, Set<Sid> sids, int page, int pageSize); @Override Set<LabelledPermission> getPermissions(Set<Sid> sids, boolean isReturnInherited); @Override Set<LabelledObject> getObjects(String typeId, int page, int pageSize); @Override Set<PermissionSet> getSuitablePermissionsForType(String typeId); @Override boolean exists(ObjectIdentity objectIdentity, Sid sid); }
PermissionServiceDecorator implements PermissionService { @Override public void updatePermission(Permission permission) { checkForSu(permission.getSid()); checkSuOrOwner(permission.getObjectIdentity()); permissionService.updatePermission(permission); } PermissionServiceDecorator(
      PermissionService permissionService,
      EntityHelper entityHelper,
      UserRoleTools userRoleTools,
      MutableAclService mutableAclService,
      MutableAclClassService mutableAclClassService,
      UserPermissionEvaluator userPermissionEvaluator); @Override Set<LabelledType> getLabelledTypes(); @Override Set<LabelledPermission> getPermissionsForObject(
      ObjectIdentity objectIdentity, Set<Sid> sids, boolean isReturnInheritedPermissions); @Override void createAcl(ObjectIdentity objectIdentity); @Override void createPermission(Permission permission); @Override void createPermissions(Set<Permission> permissions); @Override void updatePermission(Permission permission); @Override void updatePermissions(Set<Permission> permissions); @Override void deletePermission(Sid sid, ObjectIdentity objectIdentity); @Override void addType(String typeId); @Override void deleteType(String typeId); @Override Map<String, Set<LabelledPermission>> getPermissionsForType(
      String typeId, Set<Sid> sids, boolean isReturnInherited); @Override Map<String, Set<LabelledPermission>> getPermissionsForType(
      String typeId, Set<Sid> sids, int page, int pageSize); @Override Set<LabelledPermission> getPermissions(Set<Sid> sids, boolean isReturnInherited); @Override Set<LabelledObject> getObjects(String typeId, int page, int pageSize); @Override Set<PermissionSet> getSuitablePermissionsForType(String typeId); @Override boolean exists(ObjectIdentity objectIdentity, Sid sid); static final String SUPERUSER; }