use of cz.metacentrum.perun.core.api.exceptions.ExternallyManagedException in project perun by CESNET.
the class GroupsManagerEntry method addMember.
@Override
public void addMember(PerunSession sess, Group group, Member member) throws MemberNotExistsException, PrivilegeException, AlreadyMemberException, GroupNotExistsException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException {
Utils.checkPerunSession(sess);
getGroupsManagerBl().checkGroupExists(sess, group);
getPerunBl().getMembersManagerBl().checkMemberExists(sess, member);
// Check if the member and group are from the same VO
if (member.getVoId() != (group.getVoId())) {
throw new MembershipMismatchException("Member and group are form the different VO");
}
// Authorization
if (!AuthzResolver.authorizedInternal(sess, "addMember_Group_Member_policy", Arrays.asList(group, member))) {
throw new PrivilegeException(sess, "addMember");
}
// Check if the group is externally synchronized
Attribute attrSynchronizeEnabled = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROENABLED_ATTRNAME);
if ("true".equals(attrSynchronizeEnabled.getValue()) || getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, group)) {
throw new ExternallyManagedException("Adding of member is not allowed. Group is externally managed.");
}
getGroupsManagerBl().addMember(sess, group, member);
}
use of cz.metacentrum.perun.core.api.exceptions.ExternallyManagedException in project perun by CESNET.
the class GroupsManagerEntry method addMembers.
@Override
public void addMembers(PerunSession sess, Group group, List<Member> members) throws MemberNotExistsException, PrivilegeException, AlreadyMemberException, GroupNotExistsException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException {
Utils.checkPerunSession(sess);
getGroupsManagerBl().checkGroupExists(sess, group);
for (Member member : members) {
getPerunBl().getMembersManagerBl().checkMemberExists(sess, member);
// Check if the member and group are from the same VO
if (member.getVoId() != (group.getVoId())) {
throw new MembershipMismatchException("Member and group are form the different VO");
}
}
// Authorization
for (Member member : members) {
if (!AuthzResolver.authorizedInternal(sess, "addMembers_Group_List<Member>_policy", member, group)) {
throw new PrivilegeException(sess, "addMembers");
}
}
// Check if the group is externally synchronized
Attribute attrSynchronizeEnabled = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROENABLED_ATTRNAME);
if ("true".equals(attrSynchronizeEnabled.getValue()) || getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, group)) {
throw new ExternallyManagedException("Adding of member is not allowed. Group is externally managed.");
}
getGroupsManagerBl().addMembers(sess, group, members);
}
use of cz.metacentrum.perun.core.api.exceptions.ExternallyManagedException in project perun by CESNET.
the class GroupsManagerEntry method removeMember.
@Override
public void removeMember(PerunSession sess, Group group, Member member) throws MemberNotExistsException, NotGroupMemberException, PrivilegeException, GroupNotExistsException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException {
Utils.checkPerunSession(sess);
getGroupsManagerBl().checkGroupExists(sess, group);
getPerunBl().getMembersManagerBl().checkMemberExists(sess, member);
// Authorization
if (!AuthzResolver.authorizedInternal(sess, "removeMember_Group_Member_policy", Arrays.asList(group, member))) {
throw new PrivilegeException(sess, "removeMember");
}
// Check if the group is externally synchronized
Attribute attrSynchronizeEnabled = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROENABLED_ATTRNAME);
if ("true".equals(attrSynchronizeEnabled.getValue()) || getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, group)) {
throw new ExternallyManagedException("Removing of member is not allowed. Group is externally managed.");
}
getGroupsManagerBl().removeMember(sess, group, member);
}
use of cz.metacentrum.perun.core.api.exceptions.ExternallyManagedException in project perun by CESNET.
the class GroupsManagerEntry method removeMembers.
@Override
public void removeMembers(PerunSession sess, Group group, List<Member> members) throws MemberNotExistsException, NotGroupMemberException, PrivilegeException, GroupNotExistsException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException {
Utils.checkPerunSession(sess);
getGroupsManagerBl().checkGroupExists(sess, group);
for (Member member : members) {
getPerunBl().getMembersManagerBl().checkMemberExists(sess, member);
}
// Authorization
for (Member member : members) {
if (!AuthzResolver.authorizedInternal(sess, "removeMembers_Group_List<Member>_policy", member, group)) {
throw new PrivilegeException(sess, "removeMembers");
}
}
// Check if the group is externally synchronized
Attribute attrSynchronizeEnabled = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROENABLED_ATTRNAME);
if ("true".equals(attrSynchronizeEnabled.getValue()) || getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, group)) {
throw new ExternallyManagedException("Removing of member is not allowed. Group is externally managed.");
}
getGroupsManagerBl().removeMembers(sess, group, members);
}
use of cz.metacentrum.perun.core.api.exceptions.ExternallyManagedException in project perun by CESNET.
the class GroupsManagerEntry method removeMember.
@Override
public void removeMember(PerunSession sess, Member member, List<Group> groups) throws MemberNotExistsException, NotGroupMemberException, PrivilegeException, GroupNotExistsException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException {
Utils.checkPerunSession(sess);
for (Group group : groups) {
getGroupsManagerBl().checkGroupExists(sess, group);
// Check if the group is externally synchronized
Attribute attrSynchronizeEnabled = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROENABLED_ATTRNAME);
if ("true".equals(attrSynchronizeEnabled.getValue()) || getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, group)) {
throw new ExternallyManagedException("Removing of member is not allowed. Group is externally managed.");
}
}
getPerunBl().getMembersManagerBl().checkMemberExists(sess, member);
// Authorization
for (Group group : groups) {
if (!AuthzResolver.authorizedInternal(sess, "removeMember_Member_List<Group>_policy", member, group)) {
throw new PrivilegeException(sess, "removeMember");
}
}
getGroupsManagerBl().removeMember(sess, groups, member);
}
Aggregations