Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
024403f5
Commit
024403f5
authored
Dec 17, 2007
by
Richard Mansfield
Browse files
Allow institutional admins access to suspended users page
parent
ed2f5455
Changes
4
Hide whitespace changes
Inline
Side-by-side
htdocs/admin/users/suspended.json.php
View file @
024403f5
...
...
@@ -25,7 +25,7 @@
*/
define
(
'INTERNAL'
,
1
);
define
(
'ADMIN'
,
1
);
define
(
'
INSTITUTIONAL
ADMIN'
,
1
);
define
(
'JSON'
,
1
);
require
(
dirname
(
dirname
(
dirname
(
__FILE__
)))
.
'/init.php'
);
...
...
@@ -35,24 +35,54 @@ json_headers();
$limit
=
param_integer
(
'limit'
,
10
);
$offset
=
param_integer
(
'offset'
,
0
);
// Filter for institutional admins:
$instsql
=
$USER
->
get
(
'admin'
)
?
''
:
'
AND ui.institution IN ('
.
join
(
','
,
array_map
(
'db_quote'
,
array_keys
(
$USER
->
get
(
'institutions'
))))
.
')'
;
// NOTE: the check is not done on the 'active' column here, since suspended
// users are by definition not active. However deleted users are filtered out.
$count
=
get_field_sql
(
'SELECT COUNT(*) FROM {usr} WHERE suspendedcusr IS NOT NULL AND deleted = 0'
);
$data
=
get_records_sql_array
(
'SELECT DISTINCT ON (u.suspendedctime, u.id) u.id, u.firstname, u.lastname, u.studentid, u.suspendedreason AS reason,
i.displayname AS institution, ua.firstname AS cusrfirstname, ua.lastname AS cusrlastname
$count
=
get_field_sql
(
'
SELECT COUNT(*)
FROM (
SELECT u.id
FROM {usr} u
LEFT OUTER JOIN {usr_institution} ui ON (ui.usr = u.id)
WHERE suspendedcusr IS NOT NULL
AND deleted = 0 '
.
$instsql
.
'
GROUP BY u.id
) AS a'
);
$data
=
get_records_sql_assoc
(
'
SELECT
u.id, u.firstname, u.lastname, u.studentid, u.suspendedctime, u.suspendedreason AS reason,
ua.firstname AS cusrfirstname, ua.lastname AS cusrlastname
FROM {usr} u
LEFT OUTER JOIN {usr_institution} ui ON (ui.usr = u.id)
LEFT OUTER JOIN {institution} i ON (ui.institution = i.name)
LEFT JOIN {usr} ua on (ua.id = u.suspendedcusr)
LEFT OUTER JOIN {usr_institution} ui ON (ui.usr = u.id)
WHERE u.suspendedcusr IS NOT NULL
AND u.deleted = 0
AND u.deleted = 0 '
.
$instsql
.
'
GROUP BY
u.id, u.firstname, u.lastname, u.studentid, u.suspendedctime, u.suspendedreason,
ua.firstname, ua.lastname
ORDER BY u.suspendedctime, u.id
LIMIT ?
OFFSET ?'
,
array
(
$limit
,
$offset
));
if
(
!
$data
)
{
$data
=
array
();
}
else
{
$institutions
=
get_records_sql_array
(
'
SELECT ui.usr, ui.studentid, i.displayname
FROM {usr_institution} ui INNER JOIN {institution} i ON ui.institution = i.name
WHERE ui.usr IN ('
.
join
(
','
,
array_keys
(
$data
))
.
')'
,
null
);
if
(
$institutions
)
{
foreach
(
$institutions
as
&
$i
)
{
$data
[
$i
->
usr
]
->
institutions
[]
=
$i
->
displayname
;
$data
[
$i
->
usr
]
->
institutionids
[]
=
$i
->
studentid
;
}
}
$data
=
array_values
(
$data
);
foreach
(
$data
as
&
$record
)
{
$record
->
name
=
full_name
(
$record
);
$record
->
firstname
=
$record
->
cusrfirstname
;
...
...
htdocs/admin/users/suspended.php
View file @
024403f5
...
...
@@ -25,7 +25,7 @@
*/
define
(
'INTERNAL'
,
1
);
define
(
'ADMIN'
,
1
);
define
(
'
INSTITUTIONAL
ADMIN'
,
1
);
define
(
'MENUITEM'
,
'configusers/suspendedusers'
);
require
(
dirname
(
dirname
(
dirname
(
__FILE__
)))
.
'/init.php'
);
define
(
'TITLE'
,
get_string
(
'suspendedusers'
,
'admin'
));
...
...
@@ -42,8 +42,12 @@ var suspendedlist = new TableRenderer(
'suspended.json.php',
[
'name',
'studentid',
'institution',
function (r) {
return TD(null, r.institutions ? map(partial(DIV, null), r.institutions) : null);
},
function (r) {
return TD(null, r.institutions ? map(partial(DIV, null), r.institutionids) : r.studentid);
},
'cusrname',
'reason',
function (rowdata) { return TD(null, INPUT({'type': 'checkbox', 'name': 'usr_' + rowdata.id})); }
...
...
htdocs/lib/web.php
View file @
024403f5
...
...
@@ -1317,41 +1317,47 @@ function admin_nav() {
'title'
=>
get_string
(
'usersearch'
,
'admin'
),
'weight'
=>
10
,
),
array
(
'path'
=>
'configusers/suspendedusers'
,
'url'
=>
'admin/users/suspended.php'
,
'title'
=>
get_string
(
'suspendedusers'
,
'admin'
),
'weight'
=>
20
,
),
array
(
'path'
=>
'configusers/institutionusers'
,
'url'
=>
'admin/users/institutionusers.php'
,
'title'
=>
get_string
(
'institutionmembers'
,
'admin'
),
'weight'
=>
2
0
,
'weight'
=>
3
0
,
),
array
(
'path'
=>
'configusers/institutionstaff'
,
'url'
=>
'admin/users/institutionstaff.php'
,
'title'
=>
get_string
(
'staffusers'
,
'admin'
),
'weight'
=>
3
0
,
'weight'
=>
4
0
,
),
array
(
'path'
=>
'configusers/institutionadmins'
,
'url'
=>
'admin/users/institutionadmins.php'
,
'title'
=>
get_string
(
'adminusers'
,
'admin'
),
'weight'
=>
4
0
,
'weight'
=>
5
0
,
),
array
(
'path'
=>
'configusers/institutions'
,
'url'
=>
'admin/users/institutions.php'
,
'title'
=>
get_string
(
'institutionsettings'
,
'admin'
),
'weight'
=>
5
0
,
'weight'
=>
6
0
,
),
array
(
'path'
=>
'configusers/adminnotifications'
,
'url'
=>
'admin/users/notifications.php'
,
'title'
=>
get_string
(
'adminnotifications'
,
'admin'
),
'weight'
=>
6
0
,
'weight'
=>
7
0
,
),
array
(
'path'
=>
'configusers/uploadcsv'
,
'url'
=>
'admin/users/uploadcsv.php'
,
'title'
=>
get_string
(
'uploadcsv'
,
'admin'
),
'weight'
=>
7
0
,
'weight'
=>
8
0
,
),
);
}
...
...
htdocs/theme/default/templates/admin/users/suspended.tpl
View file @
024403f5
...
...
@@ -9,8 +9,8 @@
<thead>
<tr>
<th>
{
str
tag
=
fullname
}
</th>
<th>
{
str
tag
=
studentid
}
</th>
<th>
{
str
tag
=
institution
}
</th>
<th>
{
str
tag
=
studentid
}
</th>
<th>
{
str
tag
=
suspendingadmin
section
=
admin
}
</th>
<th>
{
str
tag
=
suspensionreason
section
=
admin
}
</th>
<th>
{
str
tag
=
select
}
</th>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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