use of org.apereo.portal.security.RuntimeAuthorizationException in project uPortal by Jasig.
the class GroupAdministrationHelper method deleteGroup.
/**
* Delete a group from the group store
*
* @param key key of the group to be deleted
* @param user performing the delete operation
*/
public void deleteGroup(String key, IPerson deleter) {
if (!canDeleteGroup(deleter, key)) {
throw new RuntimeAuthorizationException(deleter, IPermission.DELETE_GROUP_ACTIVITY, key);
}
log.info("Deleting group with key " + key);
// find the current version of this group entity
IEntityGroup group = GroupService.findGroup(key);
// groups
for (IEntityGroup parent : group.getParentGroups()) {
parent.removeChild(group);
parent.updateMembers();
}
// delete the group
group.delete();
}
use of org.apereo.portal.security.RuntimeAuthorizationException in project uPortal by Jasig.
the class GroupAdministrationHelper method updateGroupDetails.
/**
* Update the title and description of an existing group in the group store.
*
* @param groupForm Form representing the new group configuration
* @param updater Updating user
*/
public void updateGroupDetails(GroupForm groupForm, IPerson updater) {
if (!canEditGroup(updater, groupForm.getKey())) {
throw new RuntimeAuthorizationException(updater, IPermission.EDIT_GROUP_ACTIVITY, groupForm.getKey());
}
if (log.isDebugEnabled()) {
log.debug("Updating group for group form [" + groupForm.toString() + "]");
}
// find the current version of this group entity
IEntityGroup group = GroupService.findGroup(groupForm.getKey());
group.setName(groupForm.getName());
group.setDescription(groupForm.getDescription());
// save the group, updating both its basic information and group
// membership
group.update();
}
Aggregations