-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3034 from zlamalp/meta2
REGISTRAR: Modified Metacentrum workflow
- Loading branch information
Showing
3 changed files
with
83 additions
and
12 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
perun-registrar-lib/src/main/java/cz/metacentrum/perun/registrar/modules/EinfraVerified.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package cz.metacentrum.perun.registrar.modules; | ||
|
||
import cz.metacentrum.perun.core.api.Attribute; | ||
import cz.metacentrum.perun.core.api.PerunSession; | ||
import cz.metacentrum.perun.core.api.User; | ||
import cz.metacentrum.perun.core.api.exceptions.AlreadyAdminException; | ||
import cz.metacentrum.perun.core.api.exceptions.AlreadyMemberException; | ||
import cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException; | ||
import cz.metacentrum.perun.core.api.exceptions.ExtSourceNotExistsException; | ||
import cz.metacentrum.perun.core.api.exceptions.ExtendMembershipException; | ||
import cz.metacentrum.perun.core.api.exceptions.ExternallyManagedException; | ||
import cz.metacentrum.perun.core.api.exceptions.GroupNotExistsException; | ||
import cz.metacentrum.perun.core.api.exceptions.MemberNotExistsException; | ||
import cz.metacentrum.perun.core.api.exceptions.NotGroupMemberException; | ||
import cz.metacentrum.perun.core.api.exceptions.PrivilegeException; | ||
import cz.metacentrum.perun.core.api.exceptions.UserNotExistsException; | ||
import cz.metacentrum.perun.core.api.exceptions.VoNotExistsException; | ||
import cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException; | ||
import cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException; | ||
import cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException; | ||
import cz.metacentrum.perun.core.bl.PerunBl; | ||
import cz.metacentrum.perun.registrar.exceptions.RegistrarException; | ||
import cz.metacentrum.perun.registrar.impl.RegistrarManagerImpl; | ||
import cz.metacentrum.perun.registrar.model.Application; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
import static cz.metacentrum.perun.registrar.modules.Metacentrum.A_USER_IS_CESNET_ELIGIBLE_LAST_SEEN; | ||
|
||
public class EinfraVerified extends DefaultRegistrarModule { | ||
|
||
private final static Logger log = LoggerFactory.getLogger(EinfraVerified.class); | ||
|
||
@Override | ||
public Application approveApplication(PerunSession session, Application app) throws UserNotExistsException, PrivilegeException, AlreadyAdminException, GroupNotExistsException, VoNotExistsException, MemberNotExistsException, AlreadyMemberException, ExternallyManagedException, WrongAttributeValueException, WrongAttributeAssignmentException, AttributeNotExistsException, WrongReferenceAttributeValueException, RegistrarException, ExtendMembershipException, ExtSourceNotExistsException, NotGroupMemberException { | ||
|
||
PerunBl perun = (PerunBl) session.getPerun(); | ||
User user = app.getUser(); | ||
|
||
// format now | ||
LocalDateTime now = LocalDateTime.now(); | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | ||
String eligibleValue = now.format(formatter); | ||
|
||
// set attribute | ||
Attribute attribute = perun.getAttributesManagerBl().getAttribute(session, user, A_USER_IS_CESNET_ELIGIBLE_LAST_SEEN); | ||
attribute.setValue(eligibleValue); | ||
perun.getAttributesManagerBl().setAttribute(session, user, attribute); | ||
|
||
return app; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters