mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
merged change, fixed a bug where'0' is written when calling capability_assign()
This commit is contained in:
parent
29651b84a5
commit
96986241f5
@ -1421,13 +1421,15 @@ function delete_role($roleid) {
|
||||
* @param contextid - context id
|
||||
* @param roleid - role id
|
||||
* @param permission - int 1,-1 or -1000
|
||||
* should not be writing if permission is 0
|
||||
*/
|
||||
function assign_capability($capability, $permission, $roleid, $contextid, $overwrite=false) {
|
||||
|
||||
global $USER;
|
||||
|
||||
if (empty($permission) || $permission == 0) { // if permission is not set
|
||||
if (empty($permission) || $permission == CAP_INHERIT) { // if permission is not set
|
||||
unassign_capability($capability, $roleid, $contextid);
|
||||
return true;
|
||||
}
|
||||
|
||||
$existing = get_record('role_capabilities', 'contextid', $contextid, 'roleid', $roleid, 'capability', $capability);
|
||||
|
Loading…
x
Reference in New Issue
Block a user