File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,17 +33,22 @@ public function post()
3333 $ formData = $ app ->input ->getArray ();
3434 $ userIdentifier = $ app ->input ->get ('id ' , 0 , 'string ' );
3535
36+ if (isset ($ formData ['fields ' ]))
37+ {
38+ $ formData ['com_fields ' ] = $ formData ['fields ' ];
39+ unset($ formData ['fields ' ]);
40+ }
41+
3642 // Get current logged in user.
3743 $ me = $ this ->plugin ->get ('user ' );
44+ $ iAmSuperAdmin = $ me ->authorise ('core.create ' );
3845
3946 if (!empty ($ userIdentifier ))
4047 {
4148 $ user = $ this ->retriveUser ($ userIdentifier );
4249
4350 if (!empty ($ user ->id ))
4451 {
45- $ iAmSuperAdmin = $ me ->authorise ('core.create ' );
46-
4752 // Check if regular user is trying to update his/her own profile OR if user is superadmin
4853 if ($ me ->id == $ user ->id || $ iAmSuperAdmin )
4954 {
@@ -81,6 +86,13 @@ public function post()
8186 // Check if $userIdentifier is not set - POST / CREATE user case
8287 else
8388 {
89+ if (!$ iAmSuperAdmin )
90+ {
91+ ApiError::raiseError (400 , JText::_ ('JERROR_ALERTNOAUTHOR ' ));
92+
93+ return ;
94+ }
95+
8496 // Validate required fields
8597 if ($ formData ['username ' ] == '' || $ formData ['name ' ] == '' || $ formData ['email ' ] == '' )
8698 {
You can’t perform that action at this time.
0 commit comments