Loading perun-core/src/main/java/cz/metacentrum/perun/core/blImpl/MembersManagerBlImpl.java +14 −0 Changes for perun-core/src/main/java/cz/metacentrum/perun/core/blImpl/MembersManagerBlImpl.java: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -383,6 +383,20 @@ public class MembersManagerBlImpl implements MembersManagerBl { throw new InternalErrorException("Shouldn't happen."); } if (loa == null) { // Get user LOA try { Attribute loaAttr = getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_VIRT + ":loa"); loa = Integer.toString((Integer) loaAttr.getValue()); } catch (AttributeNotExistsException e) { // user has no loa defined - if required by VO, it will be stopped in checking method later } catch (WrongAttributeAssignmentException e) { throw new InternalErrorException(e); } } // Which LOA we won't allow? if (membershipExpirationRules.get(AbstractMembershipExpirationRulesModule.MEMBERSHIP_DO_NOT_ALLOW_LOA_KEY_NAME) != null) { Loading perun-openapi/openapi.yml +16 −0 Changes for perun-openapi/openapi.yml: 16 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -11112,6 +11112,22 @@ paths: default: $ref: '#/components/responses/ExceptionResponse' /json/membersManager/canBeMemberWithReasonUserId: get: tags: - MembersManager operationId: canBeMemberWithReasonUserId summary: Checks if the user can apply for membership in VO, throws error containing the reason if cannot be member. parameters: - $ref: '#/components/parameters/voId' - $ref: '#/components/parameters/userId' - { name: 'loa', in: query, required: false, schema: {type: string}, description: "User's LOA"} responses: '200': $ref: '#/components/responses/BooleanResponse' default: $ref: '#/components/responses/ExceptionResponse' /json/membersManager/getMembersCount: get: tags: Loading perun-rpc/src/main/java/cz/metacentrum/perun/rpc/methods/MembersManagerMethod.java +28 −1 Changes for perun-rpc/src/main/java/cz/metacentrum/perun/rpc/methods/MembersManagerMethod.java: 28 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -1973,7 +1973,6 @@ public enum MembersManagerMethod implements ManagerMethod { * * @param vo int VO <code>id</code> * @param user User User to check * @param loa String Level of Assurance (LoA) of user * @throw ExtendMembershipException When user can't become member of VO, reason is specified in exception text. * @exampleResponse 1 * @return int 1 if true or throws exception if false Loading @@ -1990,6 +1989,34 @@ public enum MembersManagerMethod implements ManagerMethod { } } }, /*# * Checks if the user can apply for membership in VO. * Decision is based on VO rules for: extendMembershipRules and doNotAllowLoa. * * @param vo int VO <code>id</code> * @param user int User <code>id</code> to check * @param loa String Level of Assurance (LoA) of user * @throw ExtendMembershipException When user can't become member of VO, reason is specified in exception text. * @exampleResponse 1 * @return int 1 if true or throws exception if false */ canBeMemberWithReasonUserId { @Override public Integer call(ApiCaller ac, Deserializer parms) throws PerunException { String loa = null; if (parms.contains("loa")) { loa = parms.readString("loa"); } if (ac.getMembersManager() .canBeMemberWithReason(ac.getSession(), ac.getVoById(parms.readInt("vo")), ac.getUserById(parms.readInt("user")), loa)) { return 1; } else { return 0; } } }, /*# * Checks if the caller can apply for membership in VO. Loading Loading
perun-core/src/main/java/cz/metacentrum/perun/core/blImpl/MembersManagerBlImpl.java +14 −0 Changes for perun-core/src/main/java/cz/metacentrum/perun/core/blImpl/MembersManagerBlImpl.java: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -383,6 +383,20 @@ public class MembersManagerBlImpl implements MembersManagerBl { throw new InternalErrorException("Shouldn't happen."); } if (loa == null) { // Get user LOA try { Attribute loaAttr = getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_VIRT + ":loa"); loa = Integer.toString((Integer) loaAttr.getValue()); } catch (AttributeNotExistsException e) { // user has no loa defined - if required by VO, it will be stopped in checking method later } catch (WrongAttributeAssignmentException e) { throw new InternalErrorException(e); } } // Which LOA we won't allow? if (membershipExpirationRules.get(AbstractMembershipExpirationRulesModule.MEMBERSHIP_DO_NOT_ALLOW_LOA_KEY_NAME) != null) { Loading
perun-openapi/openapi.yml +16 −0 Changes for perun-openapi/openapi.yml: 16 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -11112,6 +11112,22 @@ paths: default: $ref: '#/components/responses/ExceptionResponse' /json/membersManager/canBeMemberWithReasonUserId: get: tags: - MembersManager operationId: canBeMemberWithReasonUserId summary: Checks if the user can apply for membership in VO, throws error containing the reason if cannot be member. parameters: - $ref: '#/components/parameters/voId' - $ref: '#/components/parameters/userId' - { name: 'loa', in: query, required: false, schema: {type: string}, description: "User's LOA"} responses: '200': $ref: '#/components/responses/BooleanResponse' default: $ref: '#/components/responses/ExceptionResponse' /json/membersManager/getMembersCount: get: tags: Loading
perun-rpc/src/main/java/cz/metacentrum/perun/rpc/methods/MembersManagerMethod.java +28 −1 Changes for perun-rpc/src/main/java/cz/metacentrum/perun/rpc/methods/MembersManagerMethod.java: 28 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -1973,7 +1973,6 @@ public enum MembersManagerMethod implements ManagerMethod { * * @param vo int VO <code>id</code> * @param user User User to check * @param loa String Level of Assurance (LoA) of user * @throw ExtendMembershipException When user can't become member of VO, reason is specified in exception text. * @exampleResponse 1 * @return int 1 if true or throws exception if false Loading @@ -1990,6 +1989,34 @@ public enum MembersManagerMethod implements ManagerMethod { } } }, /*# * Checks if the user can apply for membership in VO. * Decision is based on VO rules for: extendMembershipRules and doNotAllowLoa. * * @param vo int VO <code>id</code> * @param user int User <code>id</code> to check * @param loa String Level of Assurance (LoA) of user * @throw ExtendMembershipException When user can't become member of VO, reason is specified in exception text. * @exampleResponse 1 * @return int 1 if true or throws exception if false */ canBeMemberWithReasonUserId { @Override public Integer call(ApiCaller ac, Deserializer parms) throws PerunException { String loa = null; if (parms.contains("loa")) { loa = parms.readString("loa"); } if (ac.getMembersManager() .canBeMemberWithReason(ac.getSession(), ac.getVoById(parms.readInt("vo")), ac.getUserById(parms.readInt("user")), loa)) { return 1; } else { return 0; } } }, /*# * Checks if the caller can apply for membership in VO. Loading