File tree Expand file tree Collapse file tree
modules/users/controllers Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments