Skip to content
GitLab
Menu
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
d56d5298
Commit
d56d5298
authored
Aug 08, 2016
by
Robert Lyon
Committed by
Gerrit Code Review
Aug 08, 2016
Browse files
Merge "Bug 1609200: Limit group config to group's admins"
parents
321390a2
47905d70
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/group/edit.php
View file @
d56d5298
...
...
@@ -20,7 +20,7 @@ if ($id = param_integer('id', null)) {
define
(
'TITLE'
,
get_string
(
'editgroup'
,
'group'
));
define
(
'GROUP'
,
$id
);
if
(
!
group_user_
access
(
$id
))
{
if
(
!
group_user_
can_configure
(
$id
))
{
$SESSION
->
add_error_msg
(
get_string
(
'canteditdontown'
,
'group'
));
redirect
(
'/group/mygroups.php'
);
}
...
...
htdocs/lib/group.php
View file @
d56d5298
...
...
@@ -921,6 +921,24 @@ function group_user_can_leave($group, $userid=null) {
return
(
$result
[
$group
->
id
][
$userid
]
=
true
);
}
/**
* Checks whether a user is allowed to change the group's configuration settings.
* (via edit/group.php)
*
* @param int $groupid Group to check
* @param int $userid User to check (default: current user)
* @param boolean $refresh Whether to re-check the user's role in the database (default: false)
*/
function
group_user_can_configure
(
$groupid
,
$userid
=
null
,
$refresh
=
false
)
{
if
(
'admin'
===
group_user_access
(
$groupid
,
$userid
,
$refresh
))
{
return
true
;
}
else
{
return
false
;
}
}
/**
* Removes a user from a group.
*
...
...
Write
Preview
Supports
Markdown
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