use of org.apache.syncope.common.lib.to.RoleTO in project syncope by apache.
the class RoleITCase method getSampleRoleTO.
public static RoleTO getSampleRoleTO(final String name) {
RoleTO role = new RoleTO();
role.setKey(name + getUUIDString());
role.getRealms().add("/even");
role.getEntitlements().add(StandardEntitlement.LOG_SET_LEVEL);
return role;
}
use of org.apache.syncope.common.lib.to.RoleTO in project syncope by apache.
the class RoleITCase method update.
@Test
public void update() {
RoleTO role = getSampleRoleTO("update");
role = createRole(role);
assertNotNull(role);
assertFalse(role.getEntitlements().contains(StandardEntitlement.WORKFLOW_TASK_LIST));
assertFalse(role.getRealms().contains("/even/two"));
role.getEntitlements().add(StandardEntitlement.WORKFLOW_TASK_LIST);
role.getRealms().add("/even/two");
roleService.update(role);
role = roleService.read(role.getKey());
assertTrue(role.getEntitlements().contains(StandardEntitlement.WORKFLOW_TASK_LIST));
assertTrue(role.getRealms().contains("/even/two"));
}
use of org.apache.syncope.common.lib.to.RoleTO in project syncope by apache.
the class Security method buildTabList.
private List<ITab> buildTabList() {
final List<ITab> tabs = new ArrayList<>();
tabs.add(new AbstractTab(new ResourceModel("roles")) {
private static final long serialVersionUID = -6815067322125799251L;
@Override
public Panel getPanel(final String panelId) {
return new RoleDirectoryPanel.Builder(getPageReference()) {
private static final long serialVersionUID = -5960765294082359003L;
}.addNewItemPanelBuilder(new RoleWizardBuilder(new RoleTO(), getPageReference()), true).build(panelId);
}
});
tabs.add(new AbstractTab(new ResourceModel("dynRealms")) {
private static final long serialVersionUID = -6815067322125799251L;
@Override
public Panel getPanel(final String panelId) {
return new DynRealmDirectoryPanel.Builder(getPageReference()) {
private static final long serialVersionUID = -5960765294082359003L;
}.build(panelId);
}
});
tabs.add(new AbstractTab(new ResourceModel("applications")) {
private static final long serialVersionUID = -6815067322125799251L;
@Override
public Panel getPanel(final String panelId) {
return new ApplicationDirectoryPanel.Builder(getPageReference()) {
private static final long serialVersionUID = -5960765294082359003L;
}.build(panelId);
}
});
tabs.add(new AbstractTab(new ResourceModel("securityQuestions")) {
private static final long serialVersionUID = -6815067322125799251L;
@Override
public Panel getPanel(final String panelId) {
return new SecurityQuestionsPanel(panelId, getPageReference());
}
});
return tabs;
}
use of org.apache.syncope.common.lib.to.RoleTO in project syncope by apache.
the class RoleDataBinderImpl method getRoleTO.
@Override
public RoleTO getRoleTO(final Role role) {
RoleTO roleTO = new RoleTO();
roleTO.setKey(role.getKey());
roleTO.getEntitlements().addAll(role.getEntitlements());
roleTO.getRealms().addAll(role.getRealms().stream().map(Realm::getFullPath).collect(Collectors.toList()));
roleTO.getDynRealms().addAll(role.getDynRealms().stream().map(Entity::getKey).collect(Collectors.toList()));
if (role.getDynMembership() != null) {
roleTO.setDynMembershipCond(role.getDynMembership().getFIQLCond());
}
roleTO.getPrivileges().addAll(role.getPrivileges().stream().map(Entity::getKey).collect(Collectors.toList()));
return roleTO;
}
use of org.apache.syncope.common.lib.to.RoleTO in project syncope by apache.
the class RoleLogic method delete.
@PreAuthorize("hasRole('" + StandardEntitlement.ROLE_DELETE + "')")
public RoleTO delete(final String key) {
Role role = roleDAO.find(key);
if (role == null) {
LOG.error("Could not find role '" + key + "'");
throw new NotFoundException(key);
}
RoleTO deleted = binder.getRoleTO(role);
roleDAO.delete(key);
return deleted;
}
Aggregations