@Test public void getRolesForPrivilege() { AcmPlugin plugin = createPlugin("test plugin"); unit.registerPlugin(plugin); List<String> roles = unit.getRolesForPrivilege(privilegeAdd); assertEquals(3, roles.size()); }
public List<String> getRolesForPrivilege(String privilege) { List<String> retval = new LinkedList<>(); for (Map.Entry<String, List<String>> roleToPrivileges : configurablePrivilegesByRole.entrySet()) { if (roleToPrivileges.getValue() != null && roleToPrivileges.getValue().contains(privilege) && !retval.contains(roleToPrivileges.getKey())) { retval.add(roleToPrivileges.getKey()); } } return retval; }
AcmPluginManager implements ApplicationContextAware, ApplicationListener<AbstractContextHolderEvent> { public List<String> getRolesForPrivilege(String privilege) { List<String> retval = new LinkedList<>(); for (Map.Entry<String, List<String>> roleToPrivileges : configurablePrivilegesByRole.entrySet()) { if (roleToPrivileges.getValue() != null && roleToPrivileges.getValue().contains(privilege) && !retval.contains(roleToPrivileges.getKey())) { retval.add(roleToPrivileges.getKey()); } } return retval; } }
AcmPluginManager implements ApplicationContextAware, ApplicationListener<AbstractContextHolderEvent> { public List<String> getRolesForPrivilege(String privilege) { List<String> retval = new LinkedList<>(); for (Map.Entry<String, List<String>> roleToPrivileges : configurablePrivilegesByRole.entrySet()) { if (roleToPrivileges.getValue() != null && roleToPrivileges.getValue().contains(privilege) && !retval.contains(roleToPrivileges.getKey())) { retval.add(roleToPrivileges.getKey()); } } return retval; }  }
AcmPluginManager implements ApplicationContextAware, ApplicationListener<AbstractContextHolderEvent> { public List<String> getRolesForPrivilege(String privilege) { List<String> retval = new LinkedList<>(); for (Map.Entry<String, List<String>> roleToPrivileges : configurablePrivilegesByRole.entrySet()) { if (roleToPrivileges.getValue() != null && roleToPrivileges.getValue().contains(privilege) && !retval.contains(roleToPrivileges.getKey())) { retval.add(roleToPrivileges.getKey()); } } return retval; }  synchronized Collection<AcmPlugin> getAcmPlugins(); synchronized void registerPlugin(AcmPlugin plugin); @Override void setApplicationContext(ApplicationContext applicationContext); List<String> getPrivilegesForRole(String role); List<AcmPluginUrlPrivilege> getUrlPrivileges(); List<String> getRolesForPrivilege(String privilege); synchronized void registerPluginPrivileges(AcmPluginPrivileges pluginPrivileges); void setSpringContextHolder(SpringContextHolder springContextHolder); @Override void onApplicationEvent(AbstractContextHolderEvent event); }
AcmPluginManager implements ApplicationContextAware, ApplicationListener<AbstractContextHolderEvent> { public List<String> getRolesForPrivilege(String privilege) { List<String> retval = new LinkedList<>(); for (Map.Entry<String, List<String>> roleToPrivileges : configurablePrivilegesByRole.entrySet()) { if (roleToPrivileges.getValue() != null && roleToPrivileges.getValue().contains(privilege) && !retval.contains(roleToPrivileges.getKey())) { retval.add(roleToPrivileges.getKey()); } } return retval; }  synchronized Collection<AcmPlugin> getAcmPlugins(); synchronized void registerPlugin(AcmPlugin plugin); @Override void setApplicationContext(ApplicationContext applicationContext); List<String> getPrivilegesForRole(String role); List<AcmPluginUrlPrivilege> getUrlPrivileges(); List<String> getRolesForPrivilege(String privilege); synchronized void registerPluginPrivileges(AcmPluginPrivileges pluginPrivileges); void setSpringContextHolder(SpringContextHolder springContextHolder); @Override void onApplicationEvent(AbstractContextHolderEvent event); static final String PLUGINS_PRIVILEGES_FOLDER_NAME; }