use of cz.metacentrum.perun.core.api.exceptions.MemberGroupMismatchException in project perun by CESNET.
the class MembersManagerBlImpl method getRichMembersWithAttributesByNames.
@Override
public List<RichMember> getRichMembersWithAttributesByNames(PerunSession sess, Group group, List<String> attrsNames) throws AttributeNotExistsException {
List<Member> members = new ArrayList<>(perunBl.getGroupsManagerBl().getGroupMembers(sess, group));
List<RichMember> richMembers = this.convertMembersToRichMembers(sess, members);
List<AttributeDefinition> attrsDef = new ArrayList<>();
for (String atrrName : attrsNames) {
AttributeDefinition attrDef = perunBl.getAttributesManagerBl().getAttributeDefinition(sess, atrrName);
attrsDef.add(attrDef);
}
List<RichMember> richMembersWithAttributes = null;
try {
richMembersWithAttributes = this.convertMembersToRichMembersWithAttributes(sess, group, richMembers, attrsDef);
} catch (MemberGroupMismatchException e) {
throw new InternalErrorException(e);
}
return richMembersWithAttributes;
}
use of cz.metacentrum.perun.core.api.exceptions.MemberGroupMismatchException in project perun by CESNET.
the class ModulesUtilsBlImpl method getSendRightFromAttributes.
@Override
public boolean getSendRightFromAttributes(PerunSessionImpl sess, Member member, Group group, String booleanAttribute, String listAttribute) {
try {
Attribute sendAs = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, member, group, booleanAttribute);
if (sendAs.getValue() != null && sendAs.valueAsBoolean()) {
return true;
}
Attribute sendAsGroups = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, listAttribute);
if (sendAsGroups.getValue() == null) {
return false;
}
List<String> subgroups = sendAsGroups.valueAsList();
for (String groupId : subgroups) {
Group subgroup = sess.getPerunBl().getGroupsManagerBl().getGroupById(sess, Integer.parseInt(groupId));
if (sess.getPerunBl().getGroupsManagerBl().isGroupMember(sess, subgroup, member)) {
return true;
}
}
return false;
} catch (MemberGroupMismatchException | GroupNotExistsException e) {
throw new InternalErrorException(e);
} catch (WrongAttributeAssignmentException | AttributeNotExistsException e) {
throw new ConsistencyErrorException(e);
}
}
use of cz.metacentrum.perun.core.api.exceptions.MemberGroupMismatchException in project perun by CESNET.
the class MembersManagerBlImpl method getRichMembersWithAttributes.
@Override
public List<RichMember> getRichMembersWithAttributes(PerunSession sess, Group group, List<Member> members, List<AttributeDefinition> attrsDef) {
List<RichMember> richMembers = this.convertMembersToRichMembers(sess, members);
List<RichMember> richMembersWithAttributes;
try {
richMembersWithAttributes = this.convertMembersToRichMembersWithAttributes(sess, group, richMembers, attrsDef);
} catch (MemberGroupMismatchException e) {
throw new InternalErrorException(e);
}
return richMembersWithAttributes;
}
use of cz.metacentrum.perun.core.api.exceptions.MemberGroupMismatchException in project perun by CESNET.
the class GenDataProviderImpl method loadMemberGroupAttributes.
@Override
public void loadMemberGroupAttributes(Group group, List<Member> members) {
lastLoadedGroup = group;
memberGroupAttrs = new HashMap<>();
try {
memberGroupAttrs.putAll(sess.getPerunBl().getAttributesManagerBl().getRequiredAttributes(sess, service, members, group));
} catch (MemberGroupMismatchException e) {
throw new InternalErrorException(e);
}
}
Aggregations