Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
059c9848
Commit
059c9848
authored
Nov 07, 2011
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add PeerExports(), Delete(), and AddMemberShip() methods for portal
support. Also manager_urn() db slot access.
parent
b9da5d29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
db/Project.pm.in
db/Project.pm.in
+51
-0
No files found.
db/Project.pm.in
View file @
059c9848
...
...
@@ -126,6 +126,7 @@ sub IsLocal($) { return (defined($_[0]->nonlocal_id()) ? 0 : 1); };
sub
IsNonLocal
($)
{
return
(
defined
($
_
[
0
]->
nonlocal_id
())
?
1
:
0
);
};
sub
nonlocal_id
($)
{
return
field
($
_
[
0
],
"nonlocal_id"
);
}
sub
nonlocal_type
($)
{
return
field
($
_
[
0
],
"nonlocal_type"
);
}
sub
manager_urn
($)
{
return
field
($
_
[
0
],
"manager_urn"
);
}
#
These
come
from
the
group
not
the
project
.
sub
unix_gid
($)
{
return
$
_
[
0
]->{
'GROUP'
}->
unix_gid
();
}
...
...
@@ -327,6 +328,26 @@ sub Create($$$$)
return
$
newproject
;
}
#
#
Delete
newly
added
project
,
as
for
errors
.
#
sub
Delete
($)
{
my
($
self
)
=
@
_
;
my
$
pid_idx
=
$
self
->
pid_idx
();
my
$
group
=
$
self
->
GetProjectGroup
();
$
group
->
Delete
()
if
(
!defined($group));
DBQueryWarn
(
"delete from project_stats where pid_idx=$pid_idx"
)
or
return
-
1
;
DBQueryWarn
(
"delete from projects where pid_idx=$pid_idx"
)
or
return
-
1
;
return
0
;
}
#
#
Equality
test
for
two
projects
.
Not
necessary
in
perl
,
but
good
form
.
#
...
...
@@ -764,5 +785,35 @@ sub ValidPID($$)
TBDB_CHECKDBSLOT_ERROR
());
}
#
#
Add
a
user
to
the
Project
#
sub
AddMemberShip
($$;$)
{
my
($
self
,
$
user
,
$
trust
)
=
@
_
;
#
Must
be
a
real
reference
.
return
-
1
if
(
! (ref($self) && ref($user)));
my
$
membership
=
$
self
->
LookupUser
($
user
);
if
(
defined
($
membership
))
{
print
"*** AddMemberShip: $user is already a member of $self!
\n
"
;
return
-
1
;
}
return
$
self
->{
'GROUP'
}->
AddMemberShip
($
user
,
$
trust
);
}
#
#
Return
group_exports
info
,
as
a
plain
hash
.
#
sub
PeerExports
($$)
{
my
($
self
,
$
pref
)
=
@
_
;
return
$
self
->{
'GROUP'
}->
PeerExports
($
pref
);
}
#
_Always_
make
sure
that
this
1
is
at
the
end
of
the
file
...
1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment