@Test void testCreatePermissions() { MutableAcl acl = mock(MutableAcl.class); MutableAcl acl2 = mock(MutableAcl.class); doReturn(acl) .when(mutableAclService) .readAclById(new ObjectIdentityImpl("entity-typeId", "identifier")); doReturn(acl2) .when(mutableAclService) .readAclById(new ObjectIdentityImpl("entity-typeId", "identifier2")); Permission permission1 = Permission.create( new ObjectIdentityImpl("entity-typeId", "identifier"), new GrantedAuthoritySid("ROLE_role"), WRITE); Permission permission2 = Permission.create( new ObjectIdentityImpl("entity-typeId", "identifier2"), new PrincipalSid("user1"), READ); Sid expectedSid = new GrantedAuthoritySid("ROLE_role"); Sid expectedSid2 = new PrincipalSid("user1"); when(mutableAclClassService.getAclClassTypes()).thenReturn(singletonList("entity-typeId")); permissionsApiService.createPermissions(Sets.newHashSet(permission1, permission2)); verify(acl).insertAce(0, WRITE, expectedSid, true); verify(acl2).insertAce(0, READ, expectedSid2, true); verify(mutableAclService).updateAcl(acl); }
@Override @Transactional public void createPermissions(Set<Permission> permissions) { for (Permission permission : permissions) { createPermission(permission); } }
PermissionServiceImpl implements PermissionService { @Override @Transactional public void createPermissions(Set<Permission> permissions) { for (Permission permission : permissions) { createPermission(permission); } } }
PermissionServiceImpl implements PermissionService { @Override @Transactional public void createPermissions(Set<Permission> permissions) { for (Permission permission : permissions) { createPermission(permission); } } PermissionServiceImpl(
      MutableAclService mutableAclService,
      PermissionInheritanceResolver inheritanceResolver,
      ObjectIdentityService objectIdentityService,
      DataService dataService,
      MutableAclClassService mutableAclClassService,
      UserRoleTools userRoleTools,
      EntityHelper entityHelper,
      UserPermissionEvaluator userPermissionEvaluator); }
PermissionServiceImpl implements PermissionService { @Override @Transactional public void createPermissions(Set<Permission> permissions) { for (Permission permission : permissions) { createPermission(permission); } } PermissionServiceImpl(
      MutableAclService mutableAclService,
      PermissionInheritanceResolver inheritanceResolver,
      ObjectIdentityService objectIdentityService,
      DataService dataService,
      MutableAclClassService mutableAclClassService,
      UserRoleTools userRoleTools,
      EntityHelper entityHelper,
      UserPermissionEvaluator userPermissionEvaluator); @Override Set<LabelledType> getLabelledTypes(); @Override Set<LabelledObject> getObjects(String typeId, int page, int pageSize); @Override Set<PermissionSet> getSuitablePermissionsForType(String typeId); @Override Set<LabelledPermission> getPermissionsForObject(
      ObjectIdentity objectIdentity, Set<Sid> sids, boolean isReturnInheritedPermissions); @Override Set<LabelledPermission> getPermissions(Set<Sid> sids, boolean isReturnInherited); @Override Map<String, Set<LabelledPermission>> getPermissionsForType(
      String typeId, Set<Sid> sids, int page, int pageSize); @Override Map<String, Set<LabelledPermission>> getPermissionsForType(
      String typeId, Set<Sid> sids, boolean isReturnInherited); @Override @Transactional void createAcl(ObjectIdentity objectIdentity); @Override @Transactional void createPermission(Permission permission); @Override @Transactional void createPermissions(Set<Permission> permissions); @Override @Transactional void updatePermission(Permission permission); @Override @Transactional void updatePermissions(Set<Permission> permissions); @Override @Transactional void deletePermission(Sid sid, ObjectIdentity objectIdentity); @Override @Transactional void addType(String typeId); @Override @Transactional void deleteType(String typeId); @Override boolean exists(ObjectIdentity objectIdentity, Sid sid); }
PermissionServiceImpl implements PermissionService { @Override @Transactional public void createPermissions(Set<Permission> permissions) { for (Permission permission : permissions) { createPermission(permission); } } PermissionServiceImpl(
      MutableAclService mutableAclService,
      PermissionInheritanceResolver inheritanceResolver,
      ObjectIdentityService objectIdentityService,
      DataService dataService,
      MutableAclClassService mutableAclClassService,
      UserRoleTools userRoleTools,
      EntityHelper entityHelper,
      UserPermissionEvaluator userPermissionEvaluator); @Override Set<LabelledType> getLabelledTypes(); @Override Set<LabelledObject> getObjects(String typeId, int page, int pageSize); @Override Set<PermissionSet> getSuitablePermissionsForType(String typeId); @Override Set<LabelledPermission> getPermissionsForObject(
      ObjectIdentity objectIdentity, Set<Sid> sids, boolean isReturnInheritedPermissions); @Override Set<LabelledPermission> getPermissions(Set<Sid> sids, boolean isReturnInherited); @Override Map<String, Set<LabelledPermission>> getPermissionsForType(
      String typeId, Set<Sid> sids, int page, int pageSize); @Override Map<String, Set<LabelledPermission>> getPermissionsForType(
      String typeId, Set<Sid> sids, boolean isReturnInherited); @Override @Transactional void createAcl(ObjectIdentity objectIdentity); @Override @Transactional void createPermission(Permission permission); @Override @Transactional void createPermissions(Set<Permission> permissions); @Override @Transactional void updatePermission(Permission permission); @Override @Transactional void updatePermissions(Set<Permission> permissions); @Override @Transactional void deletePermission(Sid sid, ObjectIdentity objectIdentity); @Override @Transactional void addType(String typeId); @Override @Transactional void deleteType(String typeId); @Override boolean exists(ObjectIdentity objectIdentity, Sid sid);  }