Commit 51a6d136 authored by Leigh Stoller's avatar Leigh Stoller

Add IsManager() and IsMember()

parent ac45a415
...@@ -600,6 +600,28 @@ sub IsLeader($$) ...@@ -600,6 +600,28 @@ sub IsLeader($$)
return $user->SameUser($self->GetLeader()); return $user->SameUser($self->GetLeader());
} }
sub IsManager($$)
{
my ($self, $user) = @_;
# Must be a real reference.
return 0
if (! (ref($self) && ref($user)));
return TBMinTrust($self->Trust($user), PROJMEMBERTRUST_GROUPROOT());
}
sub IsMember($$)
{
my ($self, $user) = @_;
# Must be a real reference.
return 0
if (! (ref($self) && ref($user)));
return TBMinTrust($self->Trust($user), PROJMEMBERTRUST_USER());
}
# #
# Return project group. # Return project group.
# #
......
<?php <?php
# #
# Copyright (c) 2006-2018 University of Utah and the Flux Group. # Copyright (c) 2006-2019 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -518,6 +518,17 @@ class Project ...@@ -518,6 +518,17 @@ class Project
} }
return 0; return 0;
} }
function IsManager($user) {
global $TBDB_TRUST_GROUPROOT;
$pid = $this->pid();
$uid = $user->uid();
if (TBMinTrust(TBGrpTrust($uid, $pid, $pid), $TBDB_TRUST_GROUPROOT)) {
return 1;
}
return 0;
}
# #
# Add *new* member to project group; starts out with trust=none. # Add *new* member to project group; starts out with trust=none.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment