Skip to content

Commit 379303d

Browse files
committed
regression fix non-admin users unable to edit profile
1 parent ebe1a0a commit 379303d

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

framework/core/controllers/expController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ abstract class expController {
5252
'export' => 'Export Items'
5353
);
5454
protected $remove_permissions = array(); // $permissions not applicable for this module from above list
55-
protected $add_permissions = array(); // additional $permissions processed and visible for this module
55+
protected $add_permissions = array(); // additional $permissions processed and visible for this module
5656
protected $manage_permissions = array(); // additional actions requiring manage permission in addition to $m_permissions
5757
public $requires_login = array(); // actions/methods (lower case ONLY) which ONLY require user be logged in to access...$permissions take priority
5858

framework/modules/users/controllers/usersController.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class usersController extends expController {
4545
);
4646

4747
public $requires_login = array(
48-
'change_password' => 'You may not change a password without being logged in.'
48+
'change_password' => 'You may not change a password without being logged in.',
49+
'edit' => 'Edit Users',
4950
);
5051

5152
static function displayname() {
@@ -68,6 +69,16 @@ static function canImportData() {
6869
return true;
6970
}
7071

72+
// create a permission specific to the module; return true grants permission, false continues with other permission checks
73+
public static function checkPermissions($permission, $location) {
74+
global $user;
75+
76+
if (!empty($user->id) && $permission === 'edit') {
77+
// users must be allowed to edit their own profiles
78+
return true;
79+
}
80+
return false;
81+
}
7182
public function show() {
7283
global $user;
7384

0 commit comments

Comments
 (0)