@Test(expected = DuplicatePrivilegeException.class) public void testCretePrivilege_duplicateFromOrient() { CPrivilege privilege = new MemoryCPrivilege(); privilege.setId("dup"); privilege.setName("dup"); doThrow(new DuplicatePrivilegeException("dup")).when(memorySecurityConfiguration).addPrivilege(privilege); manager.createPrivilege(privilege); }
@Override public void createPrivilege(final CPrivilege privilege) { if (getMergedConfiguration().getPrivileges().stream().anyMatch(p -> p.getId().equals(privilege.getId()))) { throw new DuplicatePrivilegeException(privilege.getId()); } getDefaultConfiguration().addPrivilege(privilege); }
SecurityConfigurationManagerImpl extends ComponentSupport implements SecurityConfigurationManager, EventAware { @Override public void createPrivilege(final CPrivilege privilege) { if (getMergedConfiguration().getPrivileges().stream().anyMatch(p -> p.getId().equals(privilege.getId()))) { throw new DuplicatePrivilegeException(privilege.getId()); } getDefaultConfiguration().addPrivilege(privilege); } }
SecurityConfigurationManagerImpl extends ComponentSupport implements SecurityConfigurationManager, EventAware { @Override public void createPrivilege(final CPrivilege privilege) { if (getMergedConfiguration().getPrivileges().stream().anyMatch(p -> p.getId().equals(privilege.getId()))) { throw new DuplicatePrivilegeException(privilege.getId()); } getDefaultConfiguration().addPrivilege(privilege); } @Inject  SecurityConfigurationManagerImpl(final SecurityConfigurationSource configurationSource,
                                          final SecurityConfigurationCleaner configCleaner,
                                          final PasswordService passwordService,
                                          final EventManager eventManager); }
SecurityConfigurationManagerImpl extends ComponentSupport implements SecurityConfigurationManager, EventAware { @Override public void createPrivilege(final CPrivilege privilege) { if (getMergedConfiguration().getPrivileges().stream().anyMatch(p -> p.getId().equals(privilege.getId()))) { throw new DuplicatePrivilegeException(privilege.getId()); } getDefaultConfiguration().addPrivilege(privilege); } @Inject  SecurityConfigurationManagerImpl(final SecurityConfigurationSource configurationSource,
                                          final SecurityConfigurationCleaner configCleaner,
                                          final PasswordService passwordService,
                                          final EventManager eventManager); @Override List<CPrivilege> listPrivileges(); @Override List<CRole> listRoles(); @Override List<CUser> listUsers(); @Override List<CUserRoleMapping> listUserRoleMappings(); @Override void createPrivilege(final CPrivilege privilege); @Override void createRole(final CRole role); @Override void createUser(final CUser user, final Set<String> roles); @Override void createUser(final CUser user, final String password, final Set<String> roles); @Override void deletePrivilege(final String id); @Override void deleteRole(final String id); @Override void deleteUser(final String id); @Override CPrivilege newPrivilege(); @Override CRole newRole(); @Override CUser newUser(); @Override CUserRoleMapping newUserRoleMapping(); @Override CPrivilege readPrivilege(final String id); @Override CRole readRole(final String id); @Override CUser readUser(final String id); @Override void updatePrivilege(final CPrivilege privilege); @Override void updateRole(final CRole role); @Override void updateUser(final CUser user); @Override void updateUser(final CUser user, final Set<String> roles); @Override void createUserRoleMapping(final CUserRoleMapping userRoleMapping); @Override CUserRoleMapping readUserRoleMapping(final String userId, final String source); @Override void updateUserRoleMapping(final CUserRoleMapping userRoleMapping); @Override void deleteUserRoleMapping(final String userId, final String source); void addContributor(final SecurityContributor contributor); void removeContributor(final SecurityContributor contributor); @Override void cleanRemovedPrivilege(final String privilegeId); @AllowConcurrentEvents @Subscribe void on(final SecurityContributionChangedEvent event); }
SecurityConfigurationManagerImpl extends ComponentSupport implements SecurityConfigurationManager, EventAware { @Override public void createPrivilege(final CPrivilege privilege) { if (getMergedConfiguration().getPrivileges().stream().anyMatch(p -> p.getId().equals(privilege.getId()))) { throw new DuplicatePrivilegeException(privilege.getId()); } getDefaultConfiguration().addPrivilege(privilege); } @Inject  SecurityConfigurationManagerImpl(final SecurityConfigurationSource configurationSource,
                                          final SecurityConfigurationCleaner configCleaner,
                                          final PasswordService passwordService,
                                          final EventManager eventManager); @Override List<CPrivilege> listPrivileges(); @Override List<CRole> listRoles(); @Override List<CUser> listUsers(); @Override List<CUserRoleMapping> listUserRoleMappings(); @Override void createPrivilege(final CPrivilege privilege); @Override void createRole(final CRole role); @Override void createUser(final CUser user, final Set<String> roles); @Override void createUser(final CUser user, final String password, final Set<String> roles); @Override void deletePrivilege(final String id); @Override void deleteRole(final String id); @Override void deleteUser(final String id); @Override CPrivilege newPrivilege(); @Override CRole newRole(); @Override CUser newUser(); @Override CUserRoleMapping newUserRoleMapping(); @Override CPrivilege readPrivilege(final String id); @Override CRole readRole(final String id); @Override CUser readUser(final String id); @Override void updatePrivilege(final CPrivilege privilege); @Override void updateRole(final CRole role); @Override void updateUser(final CUser user); @Override void updateUser(final CUser user, final Set<String> roles); @Override void createUserRoleMapping(final CUserRoleMapping userRoleMapping); @Override CUserRoleMapping readUserRoleMapping(final String userId, final String source); @Override void updateUserRoleMapping(final CUserRoleMapping userRoleMapping); @Override void deleteUserRoleMapping(final String userId, final String source); void addContributor(final SecurityContributor contributor); void removeContributor(final SecurityContributor contributor); @Override void cleanRemovedPrivilege(final String privilegeId); @AllowConcurrentEvents @Subscribe void on(final SecurityContributionChangedEvent event);  }