use of org.wso2.carbon.identity.role.mgt.core.IdentityRoleManagementException in project carbon-identity-framework by wso2.
the class RoleDAOImpl method buildRolesList.
private List<RoleBasicInfo> buildRolesList(NamedPreparedStatement statement, String tenantDomain) throws SQLException, IdentityRoleManagementException {
List<RoleBasicInfo> roles = new ArrayList<>();
List<String> roleNames = new ArrayList<>();
try (ResultSet resultSet = statement.executeQuery()) {
while (resultSet.next()) {
String roleName = resultSet.getString(1);
roleNames.add(appendInternalDomain(roleName));
}
}
Map<String, String> roleNamesToIDs = getRoleIDsByNames(roleNames, tenantDomain);
// Filter scim disabled roles.
roleNames.removeAll(new ArrayList<>(roleNamesToIDs.keySet()));
// Add roleIDs for scim disabled roles.
for (String roleName : roleNames) {
roleNamesToIDs.put(roleName, addRoleID(roleName, tenantDomain));
}
roleNamesToIDs.forEach((roleName, roleID) -> roles.add(new RoleBasicInfo(roleID, removeInternalDomain(roleName))));
return roles;
}
use of org.wso2.carbon.identity.role.mgt.core.IdentityRoleManagementException in project carbon-identity-framework by wso2.
the class RoleManagementServiceImpl method deleteRole.
@Override
public void deleteRole(String roleID, String tenantDomain) throws IdentityRoleManagementException {
RoleManagementEventPublisherProxy roleManagementEventPublisherProxy = RoleManagementEventPublisherProxy.getInstance();
roleManagementEventPublisherProxy.publishPreDeleteRole(roleID, tenantDomain);
roleDAO.deleteRole(roleID, tenantDomain);
roleManagementEventPublisherProxy.publishPostDeleteRole(roleID, tenantDomain);
if (log.isDebugEnabled()) {
log.debug(String.format("%s deleted role of id : %s successfully.", getUser(tenantDomain), roleID));
}
audit.info(String.format(auditMessage, getUser(tenantDomain), "Delete role by id", roleID, getAuditData(tenantDomain), success));
}
use of org.wso2.carbon.identity.role.mgt.core.IdentityRoleManagementException in project carbon-identity-framework by wso2.
the class RoleManagementServiceImpl method updateRoleName.
@Override
public RoleBasicInfo updateRoleName(String roleID, String newRoleName, String tenantDomain) throws IdentityRoleManagementException {
RoleManagementEventPublisherProxy roleManagementEventPublisherProxy = RoleManagementEventPublisherProxy.getInstance();
roleManagementEventPublisherProxy.publishPreUpdateRoleName(roleID, newRoleName, tenantDomain);
RoleBasicInfo roleBasicInfo = roleDAO.updateRoleName(roleID, newRoleName, tenantDomain);
roleManagementEventPublisherProxy.publishPostUpdateRoleName(roleID, newRoleName, tenantDomain);
if (log.isDebugEnabled()) {
log.debug(String.format("%s updated role name of role id : %s successfully.", getUser(tenantDomain), roleID));
}
audit.info(String.format(auditMessage, getUser(tenantDomain), "Update role name by ID", roleID, getAuditData(tenantDomain, newRoleName), success));
return roleBasicInfo;
}
use of org.wso2.carbon.identity.role.mgt.core.IdentityRoleManagementException in project carbon-identity-framework by wso2.
the class RoleManagementServiceImpl method getRole.
@Override
public Role getRole(String roleID, String tenantDomain) throws IdentityRoleManagementException {
RoleManagementEventPublisherProxy roleManagementEventPublisherProxy = RoleManagementEventPublisherProxy.getInstance();
roleManagementEventPublisherProxy.publishPreGetRole(roleID, tenantDomain);
Role role = roleDAO.getRole(roleID, tenantDomain);
roleManagementEventPublisherProxy.publishPostGetRole(roleID, tenantDomain);
if (log.isDebugEnabled()) {
log.debug(String.format("%s get role of id : %s successfully.", getUser(tenantDomain), roleID));
}
return role;
}
use of org.wso2.carbon.identity.role.mgt.core.IdentityRoleManagementException in project carbon-identity-framework by wso2.
the class RoleManagementServiceImpl method updateGroupListOfRole.
@Override
public RoleBasicInfo updateGroupListOfRole(String roleID, List<String> newGroupIDList, List<String> deletedGroupIDList, String tenantDomain) throws IdentityRoleManagementException {
RoleManagementEventPublisherProxy roleManagementEventPublisherProxy = RoleManagementEventPublisherProxy.getInstance();
roleManagementEventPublisherProxy.publishPreUpdateGroupListOfRole(roleID, newGroupIDList, deletedGroupIDList, tenantDomain);
RoleBasicInfo roleBasicInfo = roleDAO.updateGroupListOfRole(roleID, newGroupIDList, deletedGroupIDList, tenantDomain);
roleManagementEventPublisherProxy.publishPostUpdateGroupListOfRole(roleID, newGroupIDList, deletedGroupIDList, tenantDomain);
if (log.isDebugEnabled()) {
log.debug(String.format("%s updated list of groups of role of id : %s successfully.", getUser(tenantDomain), roleID));
}
audit.info(String.format(auditMessage, getUser(tenantDomain), "Update group list of role by id", roleID, getAuditData(tenantDomain), success));
return roleBasicInfo;
}
Aggregations