use of edu.internet2.middleware.grouperClient.ws.beans.WsDeleteMemberResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class MemberAttributeServiceImpl method removeOwnership.
// remove ownership of a grouping from a current owner
// todo change ownerUsername to "actor"?
@Override
public GroupingsServiceResult removeOwnership(String groupingPath, String ownerUsername, String ownerToRemove) {
logger.info("removeOwnership; grouping: " + groupingPath + "; username: " + ownerUsername + "; ownerToRemove: " + ownerToRemove + ";");
GroupingsServiceResult ownershipResults;
String action = "remove ownership of " + groupingPath + " from " + ownerToRemove;
if (isOwner(groupingPath, ownerUsername) || isAdmin(ownerUsername)) {
WsSubjectLookup lookup = grouperFS.makeWsSubjectLookup(ownerUsername);
WsDeleteMemberResults memberResults = grouperFS.makeWsDeleteMemberResults(groupingPath + OWNERS, lookup, ownerToRemove);
ownershipResults = hs.makeGroupingsServiceResult(memberResults, action);
return ownershipResults;
}
ownershipResults = hs.makeGroupingsServiceResult(FAILURE + ", " + ownerUsername + " does not own " + groupingPath, action);
return ownershipResults;
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsDeleteMemberResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class MembershipServiceImpl method deleteGroupMemberByUsername.
// find a user by a username and remove them from a group
@Override
public GroupingsServiceResult deleteGroupMemberByUsername(String ownerUsername, String groupPath, String userToDeleteUsername) {
logger.info("deleteGroupMemberByUsername; user: " + ownerUsername + "; group: " + groupPath + "; userToDelete: " + userToDeleteUsername + ";");
String action = "delete " + userToDeleteUsername + " from " + groupPath;
String composite = hs.parentGroupingPath(groupPath);
if (mas.isOwner(composite, ownerUsername) || mas.isSuperuser(ownerUsername) || userToDeleteUsername.equals(ownerUsername)) {
WsSubjectLookup user = grouperFS.makeWsSubjectLookup(ownerUsername);
if (groupPath.endsWith(EXCLUDE) || groupPath.endsWith(INCLUDE) || groupPath.endsWith(OWNERS)) {
if (mas.isMember(groupPath, userToDeleteUsername)) {
WsDeleteMemberResults deleteMemberResults = grouperFS.makeWsDeleteMemberResults(groupPath, user, userToDeleteUsername);
updateLastModified(composite);
updateLastModified(groupPath);
return hs.makeGroupingsServiceResult(deleteMemberResults, action);
}
return hs.makeGroupingsServiceResult(SUCCESS + ": " + ownerUsername + " was not in " + groupPath, action);
}
return hs.makeGroupingsServiceResult(FAILURE + ": " + ownerUsername + " may only delete from exclude, include or owner group", action);
}
return hs.makeGroupingsServiceResult(FAILURE + ": " + ownerUsername + " does not have permission to edit " + groupPath, action);
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsDeleteMemberResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class MembershipServiceImpl method deleteAdmin.
// removes a user from the admins group
@Override
public GroupingsServiceResult deleteAdmin(String adminUsername, String adminToDeleteUsername) {
logger.info("deleteAdmin; username: " + adminUsername + "; adminToDelete: " + adminToDeleteUsername + ";");
String action = "delete " + adminToDeleteUsername + " from " + GROUPING_ADMINS;
if (mas.isSuperuser(adminUsername)) {
WsSubjectLookup user = grouperFS.makeWsSubjectLookup(adminUsername);
WsDeleteMemberResults deleteMemberResults = grouperFS.makeWsDeleteMemberResults(GROUPING_ADMINS, user, adminToDeleteUsername);
return hs.makeGroupingsServiceResult(deleteMemberResults, action);
}
// todo replace hard coded string with value from top
return hs.makeGroupingsServiceResult("FAILURE: " + adminUsername + " is not an admin", action);
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsDeleteMemberResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method makeWsDeleteMemberResults.
@Override
public WsDeleteMemberResults makeWsDeleteMemberResults(String group, WsSubjectLookup lookup, Person personToDelete) {
WsDeleteMemberResults wsDeleteMemberResults = new WsDeleteMemberResults();
WsResultMeta wsResultMeta = new WsResultMeta();
wsResultMeta.setResultCode(SUCCESS);
wsDeleteMemberResults.setResultMetadata(wsResultMeta);
Grouping grouping = groupingRepository.findByIncludePathOrExcludePathOrCompositePathOrOwnersPath(group, group, group, group);
if (personToDelete.getUsername() != null) {
personToDelete = personRepository.findByUsername(personToDelete.getUsername());
} else if (personToDelete.getUuid() != null) {
personToDelete = personRepository.findByUuid(personToDelete.getUuid());
}
if (grouping == null) {
Group groupToDeleteFrom = groupRepository.findByPath(group);
deleteMember(groupToDeleteFrom, personToDelete);
} else {
if (group.endsWith(OWNERS)) {
deleteMember(grouping.getOwners(), personToDelete);
} else if (group.endsWith(EXCLUDE)) {
deleteMember(grouping.getExclude(), personToDelete);
} else if (group.endsWith(INCLUDE)) {
deleteMember(grouping.getInclude(), personToDelete);
}
grouping = groupingRepository.findByPath(grouping.getPath());
grouping = groupingRepository.findByPath(grouping.getPath());
Group composite = buildComposite(grouping.getInclude(), grouping.getExclude(), grouping.getBasis(), grouping.getPath());
groupRepository.save(composite);
}
return wsDeleteMemberResults;
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsDeleteMemberResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImpl method makeWsDeleteMemberResults.
@Override
public WsDeleteMemberResults makeWsDeleteMemberResults(String group, WsSubjectLookup lookup, List<String> membersToDelete) {
GcDeleteMember deleteMember = new GcDeleteMember();
deleteMember.assignActAsSubject(lookup);
deleteMember.assignGroupName(group);
membersToDelete.forEach(deleteMember::addSubjectIdentifier);
return deleteMember.execute();
}
Aggregations