Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
ba69c7a1
Commit
ba69c7a1
authored
Nov 13, 2007
by
Russ Fish
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass project and user arguments in the XML file as an idx, not a name.
parent
68f6ddd6
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
27 deletions
+28
-27
backend/moduserinfo.in
backend/moduserinfo.in
+4
-4
backend/newgroup.in
backend/newgroup.in
+2
-2
backend/newmmlist.in
backend/newmmlist.in
+6
-5
backend/newosid.in
backend/newosid.in
+6
-6
sql/database-fill.sql
sql/database-fill.sql
+3
-2
www/group_defs.php
www/group_defs.php
+1
-1
www/newmmlist.php3
www/newmmlist.php3
+5
-6
www/user_defs.php
www/user_defs.php
+1
-1
No files found.
backend/moduserinfo.in
View file @
ba69c7a1
...
@@ -15,7 +15,7 @@ use Data::Dumper;
...
@@ -15,7 +15,7 @@ use Data::Dumper;
#
#
sub
usage
()
sub
usage
()
{
{
print
("
Usage: moduserinfo [-v] <xmlfile>
\n
");
print
("
Usage: moduserinfo [-
d] [-
v] <xmlfile>
\n
");
exit
(
-
1
);
exit
(
-
1
);
}
}
my
$optlist
=
"
dv
";
my
$optlist
=
"
dv
";
...
@@ -130,7 +130,7 @@ my $SLOT_ADMINONLY = 0x4; # Only admins can set this field.
...
@@ -130,7 +130,7 @@ my $SLOT_ADMINONLY = 0x4; # Only admins can set this field.
#
#
my
%xmlfields
=
my
%xmlfields
=
# XML Field Name DB slot name Flags Default
# XML Field Name DB slot name Flags Default
("
uid
"
=>
["
uid
",
$SLOT_REQUIRED
],
("
uid
"
=>
["
uid
_idx
",
$SLOT_REQUIRED
],
# The rest are optional, so we can skip passing ones that are not changing.
# The rest are optional, so we can skip passing ones that are not changing.
"
usr_name
"
=>
["
usr_name
",
$SLOT_OPTIONAL
],
"
usr_name
"
=>
["
usr_name
",
$SLOT_OPTIONAL
],
...
@@ -231,7 +231,7 @@ foreach my $key (keys(%{ $xmlparse->{'attribute'} })) {
...
@@ -231,7 +231,7 @@ foreach my $key (keys(%{ $xmlparse->{'attribute'} })) {
next
;
next
;
}
}
$moduserinfo_args
{
$
dbslot
}
=
$value
;
$moduserinfo_args
{
$
key
}
=
$value
;
}
}
UserError
()
UserError
()
if
(
keys
(
%errors
));
if
(
keys
(
%errors
));
...
@@ -242,7 +242,7 @@ UserError()
...
@@ -242,7 +242,7 @@ UserError()
my
$target_uid
=
$moduserinfo_args
{"
uid
"};
my
$target_uid
=
$moduserinfo_args
{"
uid
"};
my
$target_user
=
User
->
Lookup
(
$target_uid
);
my
$target_user
=
User
->
Lookup
(
$target_uid
);
if
(
!
defined
(
$target_user
))
{
if
(
!
defined
(
$target_user
))
{
UserError
("
uid: No such user
name
");
UserError
("
uid: No such user
(
$target_uid
)
");
}
}
if
(
!
$target_user
->
AccessCheck
(
$this_user
,
TB_USERINFO_MODIFYINFO
()))
{
if
(
!
$target_user
->
AccessCheck
(
$this_user
,
TB_USERINFO_MODIFYINFO
()))
{
UserError
("
UserInfo: Not enough permission
");
UserError
("
UserInfo: Not enough permission
");
...
...
backend/newgroup.in
View file @
ba69c7a1
...
@@ -130,7 +130,7 @@ my $SLOT_ADMINONLY = 0x4; # Only admins can set this field.
...
@@ -130,7 +130,7 @@ my $SLOT_ADMINONLY = 0x4; # Only admins can set this field.
#
#
my
%xmlfields
=
my
%xmlfields
=
# XML Field Name DB slot name Flags Default
# XML Field Name DB slot name Flags Default
("
project
"
=>
["
p
roject
",
$SLOT_REQUIRED
],
("
project
"
=>
["
p
id_idx
",
$SLOT_REQUIRED
],
"
group_id
"
=>
["
group_id
",
$SLOT_REQUIRED
],
"
group_id
"
=>
["
group_id
",
$SLOT_REQUIRED
],
"
group_leader
"
=>
["
group_leader
",
$SLOT_REQUIRED
],
"
group_leader
"
=>
["
group_leader
",
$SLOT_REQUIRED
],
"
group_description
"
=>
["
group_description
",
$SLOT_OPTIONAL
,
""]);
"
group_description
"
=>
["
group_description
",
$SLOT_OPTIONAL
,
""]);
...
@@ -214,7 +214,7 @@ foreach my $key (keys(%{ $xmlparse->{'attribute'} })) {
...
@@ -214,7 +214,7 @@ foreach my $key (keys(%{ $xmlparse->{'attribute'} })) {
next
;
next
;
}
}
$newgroup_args
{
$
dbslot
}
=
$value
;
$newgroup_args
{
$
key
}
=
$value
;
}
}
UserError
()
UserError
()
if
(
keys
(
%errors
));
if
(
keys
(
%errors
));
...
...
backend/newmmlist.in
View file @
ba69c7a1
...
@@ -15,7 +15,7 @@ use Data::Dumper;
...
@@ -15,7 +15,7 @@ use Data::Dumper;
#
#
sub
usage
()
sub
usage
()
{
{
print
("
Usage: newmmlist [-v] <xmlfile>
\n
");
print
("
Usage: newmmlist [-
d] [-
v] <xmlfile>
\n
");
exit
(
-
1
);
exit
(
-
1
);
}
}
my
$optlist
=
"
dv
";
my
$optlist
=
"
dv
";
...
@@ -131,7 +131,8 @@ my $SLOT_ADMINONLY = 0x4; # Only admins can set this field.
...
@@ -131,7 +131,8 @@ my $SLOT_ADMINONLY = 0x4; # Only admins can set this field.
#
#
my
%xmlfields
=
my
%xmlfields
=
# XML Field Name DB slot name Flags Default
# XML Field Name DB slot name Flags Default
("
pid
"
=>
["
pid
",
$SLOT_REQUIRED
],
("
project
"
=>
["
pid_idx
",
$SLOT_REQUIRED
],
"
password1
"
=>
["
password1
",
$SLOT_REQUIRED
],
"
password1
"
=>
["
password1
",
$SLOT_REQUIRED
],
"
password2
"
=>
["
password2
",
$SLOT_REQUIRED
],
"
password2
"
=>
["
password2
",
$SLOT_REQUIRED
],
"
listname
"
=>
["
listname
",
$SLOT_REQUIRED
],
"
listname
"
=>
["
listname
",
$SLOT_REQUIRED
],
...
@@ -216,7 +217,7 @@ foreach my $key (keys(%{ $xmlparse->{'attribute'} })) {
...
@@ -216,7 +217,7 @@ foreach my $key (keys(%{ $xmlparse->{'attribute'} })) {
next
;
next
;
}
}
$newmmlist_args
{
$
dbslot
}
=
$value
;
$newmmlist_args
{
$
key
}
=
$value
;
}
}
UserError
()
UserError
()
if
(
keys
(
%errors
));
if
(
keys
(
%errors
));
...
@@ -224,9 +225,9 @@ UserError()
...
@@ -224,9 +225,9 @@ UserError()
#
#
# Now do special checks.
# Now do special checks.
#
#
my
$project
=
Project
->
Lookup
(
$newmmlist_args
{"
p
id
"});
my
$project
=
Project
->
Lookup
(
$newmmlist_args
{"
p
roject
"});
if
(
!
defined
(
$project
))
{
if
(
!
defined
(
$project
))
{
UserError
("
Project: No such project
");
UserError
("
Project: No such project
(
$project
)
");
}
}
if
(
!
$project
->
AccessCheck
(
$this_user
,
TB_PROJECT_READINFO
()))
{
if
(
!
$project
->
AccessCheck
(
$this_user
,
TB_PROJECT_READINFO
()))
{
UserError
("
Project: Not enough permission
");
UserError
("
Project: Not enough permission
");
...
...
backend/newosid.in
View file @
ba69c7a1
...
@@ -15,7 +15,7 @@ use Data::Dumper;
...
@@ -15,7 +15,7 @@ use Data::Dumper;
#
#
sub
usage
()
sub
usage
()
{
{
print
("
Usage: newosid [-v] <xmlfile>
\n
");
print
("
Usage: newosid [-
d] [-
v] <xmlfile>
\n
");
exit
(
-
1
);
exit
(
-
1
);
}
}
my
$optlist
=
"
dv
";
my
$optlist
=
"
dv
";
...
@@ -223,7 +223,7 @@ foreach my $key (keys(%{ $xmlparse->{'attribute'} })) {
...
@@ -223,7 +223,7 @@ foreach my $key (keys(%{ $xmlparse->{'attribute'} })) {
next
;
next
;
}
}
$newosid_args
{
$
dbslot
}
=
$value
;
$newosid_args
{
$
key
}
=
$value
;
}
}
UserError
()
UserError
()
if
(
keys
(
%errors
));
if
(
keys
(
%errors
));
...
@@ -231,9 +231,9 @@ UserError()
...
@@ -231,9 +231,9 @@ UserError()
#
#
# Now do special checks.
# Now do special checks.
#
#
my
$project
=
Project
->
Lookup
(
$newosid_args
{"
p
id
"});
my
$project
=
Project
->
Lookup
(
$newosid_args
{"
p
roject
"});
if
(
!
defined
(
$project
))
{
if
(
!
defined
(
$project
))
{
UserError
("
Project: No such project
");
UserError
("
Project: No such project
(
$project
)
");
}
}
if
(
!
$project
->
AccessCheck
(
$this_user
,
TB_PROJECT_MAKEOSID
()))
{
if
(
!
$project
->
AccessCheck
(
$this_user
,
TB_PROJECT_MAKEOSID
()))
{
UserError
("
Project: Not enough permission
");
UserError
("
Project: Not enough permission
");
...
@@ -279,8 +279,8 @@ exit(0)
...
@@ -279,8 +279,8 @@ exit(0)
#
#
my
$osname
=
$newosid_args
{"
osname
"};
my
$osname
=
$newosid_args
{"
osname
"};
delete
(
$newosid_args
{"
osname
"});
delete
(
$newosid_args
{"
osname
"});
# Ditto the p
id
.
# Ditto the p
roject
.
delete
(
$newosid_args
{"
p
id
"});
delete
(
$newosid_args
{"
p
roject
"});
my
$usrerr
;
my
$usrerr
;
my
$new_osinfo
=
OSinfo
->
Create
(
$project
,
$this_user
,
$osname
,
my
$new_osinfo
=
OSinfo
->
Create
(
$project
,
$this_user
,
$osname
,
...
...
sql/database-fill.sql
View file @
ba69c7a1
...
@@ -567,7 +567,7 @@ REPLACE INTO table_regex VALUES ('experiments','sync_server','text','redirect','
...
@@ -567,7 +567,7 @@ REPLACE INTO table_regex VALUES ('experiments','sync_server','text','redirect','
REPLACE
INTO
table_regex
VALUES
(
'groups'
,
'project'
,
'text'
,
'redirect'
,
'projects:pid'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'groups'
,
'project'
,
'text'
,
'redirect'
,
'projects:pid'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'groups'
,
'gid'
,
'text'
,
'regex'
,
'^[a-zA-Z][-
\\
w]+$'
,
2
,
12
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'groups'
,
'gid'
,
'text'
,
'regex'
,
'^[a-zA-Z][-
\\
w]+$'
,
2
,
12
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'groups'
,
'gid_idx'
,
'text'
,
'regex'
,
'^[
\\
d]+$'
,
2
,
12
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'groups'
,
'gid_idx'
,
'text'
,
'regex'
,
'^[
\\
d]+$'
,
1
,
12
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'groups'
,
'group_id'
,
'text'
,
'redirect'
,
'groups:gid'
,
2
,
12
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'groups'
,
'group_id'
,
'text'
,
'redirect'
,
'groups:gid'
,
2
,
12
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'groups'
,
'group_leader'
,
'text'
,
'redirect'
,
'users:uid'
,
2
,
8
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'groups'
,
'group_leader'
,
'text'
,
'redirect'
,
'users:uid'
,
2
,
8
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'groups'
,
'group_description'
,
'text'
,
'redirect'
,
'default:tinytext'
,
0
,
256
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'groups'
,
'group_description'
,
'text'
,
'redirect'
,
'default:tinytext'
,
0
,
256
,
NULL
);
...
@@ -593,6 +593,7 @@ REPLACE INTO table_regex VALUES ('projects','URL','text','redirect','default:tin
...
@@ -593,6 +593,7 @@ REPLACE INTO table_regex VALUES ('projects','URL','text','redirect','default:tin
REPLACE
INTO
table_regex
VALUES
(
'reserved'
,
'vname'
,
'text'
,
'redirect'
,
'virt_nodes:vname'
,
1
,
32
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'reserved'
,
'vname'
,
'text'
,
'redirect'
,
'virt_nodes:vname'
,
1
,
32
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'users'
,
'uid'
,
'text'
,
'regex'
,
'^[a-zA-Z][
\\
w]+$'
,
2
,
8
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'users'
,
'uid'
,
'text'
,
'regex'
,
'^[a-zA-Z][
\\
w]+$'
,
2
,
8
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'users'
,
'uid_idx'
,
'text'
,
'regex'
,
'^[
\\
d]+$'
,
1
,
12
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'users'
,
'usr_phone'
,
'text'
,
'regex'
,
'^[-
\\
d
\\
(
\\
)
\\
+
\\
.x ]+$'
,
7
,
64
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'users'
,
'usr_phone'
,
'text'
,
'regex'
,
'^[-
\\
d
\\
(
\\
)
\\
+
\\
.x ]+$'
,
7
,
64
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'users'
,
'usr_name'
,
'text'
,
'regex'
,
'^[-
\\
w
\\
. ]+$'
,
4
,
64
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'users'
,
'usr_name'
,
'text'
,
'regex'
,
'^[-
\\
w
\\
. ]+$'
,
4
,
64
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'users'
,
'usr_email'
,
'text'
,
'regex'
,
'^([-
\\
w
\\
+
\\
.]+)
\\
@([-
\\
w
\\
.]+)$'
,
3
,
64
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'users'
,
'usr_email'
,
'text'
,
'regex'
,
'^([-
\\
w
\\
+
\\
.]+)
\\
@([-
\\
w
\\
.]+)$'
,
3
,
64
,
NULL
);
...
@@ -877,7 +878,7 @@ REPLACE INTO table_regex VALUES ('virt_firewalls','fwname','text','redirect','vi
...
@@ -877,7 +878,7 @@ REPLACE INTO table_regex VALUES ('virt_firewalls','fwname','text','redirect','vi
REPLACE
INTO
table_regex
VALUES
(
'virt_firewalls'
,
'type'
,
'text'
,
'regex'
,
'^(ipfw|ipfw2|ipchains|ipfw2-vlan)$'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_firewalls'
,
'type'
,
'text'
,
'regex'
,
'^(ipfw|ipfw2|ipchains|ipfw2-vlan)$'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_firewalls'
,
'style'
,
'text'
,
'regex'
,
'^(open|closed|basic|emulab)$'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_firewalls'
,
'style'
,
'text'
,
'regex'
,
'^(open|closed|basic|emulab)$'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'mailman_lists'
,
'pid
'
,
'text'
,
'redirect'
,
'projects:pid
'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'mailman_lists'
,
'pid
_idx'
,
'text'
,
'redirect'
,
'projects:pid_idx
'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'mailman_lists'
,
'password1'
,
'text'
,
'redirect'
,
'default:tinytext'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'mailman_lists'
,
'password1'
,
'text'
,
'redirect'
,
'default:tinytext'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'mailman_lists'
,
'password2'
,
'text'
,
'redirect'
,
'default:tinytext'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'mailman_lists'
,
'password2'
,
'text'
,
'redirect'
,
'default:tinytext'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'mailman_lists'
,
'fullname'
,
'text'
,
'redirect'
,
'users:usr_email'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'mailman_lists'
,
'fullname'
,
'text'
,
'redirect'
,
'users:usr_email'
,
0
,
0
,
NULL
);
...
...
www/group_defs.php
View file @
ba69c7a1
...
@@ -115,7 +115,7 @@ class Group
...
@@ -115,7 +115,7 @@ class Group
}
}
# Add these. Maybe caller should do this?
# Add these. Maybe caller should do this?
$args
[
"project"
]
=
$project
->
pid
();
$args
[
"project"
]
=
$project
->
pid
_idx
();
fwrite
(
$fp
,
"<group>
\n
"
);
fwrite
(
$fp
,
"<group>
\n
"
);
foreach
(
$args
as
$name
=>
$value
)
{
foreach
(
$args
as
$name
=>
$value
)
{
...
...
www/newmmlist.php3
View file @
ba69c7a1
...
@@ -329,10 +329,6 @@ if (count($errors)) {
...
@@ -329,10 +329,6 @@ if (count($errors)) {
#
#
$args
=
array
();
$args
=
array
();
if
(
isset
(
$formfields
[
"pid"
])
&&
$formfields
[
"pid"
]
!=
"none"
&&
$formfields
[
"pid"
]
!=
""
)
{
$args
[
"pid"
]
=
$formfields
[
"pid"
];
}
if
(
isset
(
$formfields
[
"password1"
])
&&
$formfields
[
"password1"
]
!=
""
)
{
if
(
isset
(
$formfields
[
"password1"
])
&&
$formfields
[
"password1"
]
!=
""
)
{
$args
[
"password1"
]
=
$formfields
[
"password1"
];
$args
[
"password1"
]
=
$formfields
[
"password1"
];
}
}
...
@@ -346,7 +342,7 @@ if (isset($formfields["fullname"]) && $formfields["fullname"] != "") {
...
@@ -346,7 +342,7 @@ if (isset($formfields["fullname"]) && $formfields["fullname"] != "") {
$args
[
"fullname"
]
=
$formfields
[
"fullname"
];
$args
[
"fullname"
]
=
$formfields
[
"fullname"
];
}
}
if
(
!
(
$result
=
NewMmList
(
$uid
,
$args
,
$errors
)))
{
if
(
!
(
$result
=
NewMmList
(
$uid
,
$
project
,
$
args
,
$errors
)))
{
# Always respit the form so that the form fields are not lost.
# Always respit the form so that the form fields are not lost.
# I just hate it when that happens so lets not be guilty of it ourselves.
# I just hate it when that happens so lets not be guilty of it ourselves.
SPITFORM
(
$formfields
,
$errors
);
SPITFORM
(
$formfields
,
$errors
);
...
@@ -362,7 +358,7 @@ header("Location: ${MAILMANURL}/admin/${listname}/?adminpw=${formfields["passwor
...
@@ -362,7 +358,7 @@ header("Location: ${MAILMANURL}/admin/${listname}/?adminpw=${formfields["passwor
#
#
# When there's an MmList class, this will be a Class function to make a new one...
# When there's an MmList class, this will be a Class function to make a new one...
#
#
function
NewMmList
(
$uid
,
$args
,
&
$errors
)
{
function
NewMmList
(
$uid
,
$
project
,
$
args
,
&
$errors
)
{
global
$suexec_output
,
$suexec_output_array
,
$TBADMINGROUP
;
global
$suexec_output
,
$suexec_output_array
,
$TBADMINGROUP
;
#
#
...
@@ -380,6 +376,9 @@ function NewMmList($uid, $args, &$errors) {
...
@@ -380,6 +376,9 @@ function NewMmList($uid, $args, &$errors) {
return
null
;
return
null
;
}
}
# Add these. Maybe caller should do this?
$args
[
"project"
]
=
$project
->
pid_idx
();
fwrite
(
$fp
,
"<MmList>
\n
"
);
fwrite
(
$fp
,
"<MmList>
\n
"
);
foreach
(
$args
as
$name
=>
$value
)
{
foreach
(
$args
as
$name
=>
$value
)
{
fwrite
(
$fp
,
"<attribute name=
\"
$name
\"
>"
);
fwrite
(
$fp
,
"<attribute name=
\"
$name
\"
>"
);
...
...
www/user_defs.php
View file @
ba69c7a1
...
@@ -172,7 +172,7 @@ class User
...
@@ -172,7 +172,7 @@ class User
}
}
# Add these. Maybe caller should do this?
# Add these. Maybe caller should do this?
$args
[
"uid"
]
=
$target_user
->
uid
();
$args
[
"uid"
]
=
$target_user
->
uid
_idx
();
fwrite
(
$fp
,
"<userinfo>
\n
"
);
fwrite
(
$fp
,
"<userinfo>
\n
"
);
foreach
(
$args
as
$name
=>
$value
)
{
foreach
(
$args
as
$name
=>
$value
)
{
...
...
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