Skip to content

Commit

Permalink
Merge pull request #733 from zlamalp/pbs
Browse files Browse the repository at this point in the history
feat(pbs_publication_fairshare): omit expired members from the export
  • Loading branch information
zlamalp authored Oct 3, 2022
2 parents 99a56cd + 9eab65e commit 2c29868
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions gen/pbs_publication_fairshare
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ our $HOW_OLD_PUBLICATIONS; *HOW_OLD_PUBLICATIONS = \3; #in yea
our $A_USER_LOGIN; *A_USER_LOGIN = \'urn:perun:user_facility:attribute-def:virt:login';
our $A_USER_ID; *A_USER_ID = \'urn:perun:user:attribute-def:core:id';
our $A_RESOURCE_FAIRSHARE_GNAME; *A_RESOURCE_FAIRSHARE_GNAME = \'urn:perun:resource:attribute-def:def:fairshareGroupName';
our $A_RESOURCE_ID; *A_RESOURCE_ID = \'urn:perun:resource:attribute-def:core:id';
our $A_MEMBER_STATUS; *A_MEMBER_STATUS = \'urn:perun:member:attribute-def:core:status';

my $nowYear = (localtime)[5] + 1900;

Expand Down Expand Up @@ -59,6 +59,10 @@ foreach my $resourceId ($data->getResourceIds()) {

foreach my $memberId ($data->getMemberIdsForResource(resource => $resourceId)) {

# process only VALID members
my $status = $data->getMemberAttributeValue(member => $memberId, attrName => $A_MEMBER_STATUS);
next unless ($status eq "VALID");

my $userId = $data->getUserIdForMember(member => $memberId);
my $userLogin = $data->getUserFacilityAttributeValue(member => $memberId, attrName => $A_USER_LOGIN);

Expand All @@ -70,7 +74,7 @@ foreach my $resourceId ($data->getResourceIds()) {
$users->{$userId}->{"weight"} = 1.0;
$users->{$userId}->{"group"} = "G:" . $fairShareGroupName;

# skip users without any publication
# skip processing publications for users without any publication
next unless defined $authorsByID->{$userId};

# gather all users publications for later processing
Expand Down Expand Up @@ -102,6 +106,10 @@ foreach my $resourceId ($data->getResourceIds()) {
my $userId = $data->getUserIdForMember(member => $memberId);
next if($users->{$userId});

# process only VALID members
my $status = $data->getMemberAttributeValue(member => $memberId, attrName => $A_MEMBER_STATUS);
next unless ($status eq "VALID");

$users->{$userId}->{"login"} = $data->getUserFacilityAttributeValue(member => $memberId, attrName => $A_USER_LOGIN);
$users->{$userId}->{"weight"} = 1.0;
$users->{$userId}->{"group"} = 'root';
Expand Down

0 comments on commit 2c29868

Please sign in to comment.