feat: 2.0 Decouple the CRUD operation#4
Conversation
manojLondhe
left a comment
There was a problem hiding this comment.
Please check all comments @thite-amol
|
|
||
| //send registration mail | ||
| /** | ||
| * send registration mail |
There was a problem hiding this comment.
The users.php file will revamp and deprecated functions will be removed from this file. I have just added a deprecated tag in it. Also the file is not PHPCS this will be done when we revamp this file.
|
|
||
| //create field array as per easysocial | ||
| /** | ||
| * create field array as per easysocial |
| /** | ||
| * Function delete for user record. | ||
| * | ||
| *@deprecated 2.0 use UsersApiResourceUser delete instead |
| @@ -30,13 +30,15 @@ | |||
| * @package Joomla.Administrator | |||
There was a problem hiding this comment.
Change everywhere
@package Com.Api
@subpackage users
src/users/user.php
Outdated
| /** | ||
| * Function retriveUser for get user details depending upon the identifier. | ||
| * | ||
| * @param string $xidentifier Flag to differnciate the column value. |
src/users/user.php
Outdated
| * | ||
| * @param Object $user The user object. | ||
| * @param Array $formData Array of user data to be added or updated. | ||
| * @param Boolean $flag Flag to differnciate the update of create action. |
src/users/user.php
Outdated
| * | ||
| * @since 2.0 | ||
| */ | ||
| private function storeUser($user, $formData, $flag = 0) |
There was a problem hiding this comment.
Can we use isNew instead of flag? and change condition accordingly?
src/users/user.php
Outdated
| private function getUserId($email) | ||
| { | ||
| // Initialise some variables | ||
| $db = JFactory::getDbo(); |
There was a problem hiding this comment.
Remove extra space after $db
src/users/user.php
Outdated
| } | ||
|
|
||
| /** | ||
| * Function to returns userid if a user exists depending on email |
src/users/user.php
Outdated
| */ | ||
| public function post() | ||
| { | ||
| $app = JFactory::getApplication(); |
There was a problem hiding this comment.
can you equi-align these lines, its hard to read?
src/users/user.php
Outdated
| $app = JFactory::getApplication(); | ||
| $userIdentifier = $app->input->get('id', 0, 'String'); | ||
| $formData = array(); | ||
| $formData['username'] = $app->input->get('username', 0, 'String'); |
There was a problem hiding this comment.
Can't this all be done with a single getArray() ?
| $user = new JUser; | ||
|
|
||
| // Create new user. | ||
| $response = $this->storeUser($user, $formData, 1); |
There was a problem hiding this comment.
Where is the ACL check for saving new user ?
There was a problem hiding this comment.
I don't think we have ACL check for registration in Joomla
There was a problem hiding this comment.
Not ACL.. I meant the check to enable / disable new user creation.
src/users/user.php
Outdated
| $response = new stdClass; | ||
|
|
||
| $xidentifier = $app->input->server->get('HTTP_IDENTIFIER'); | ||
| $fidentifier = $app->input->server->get('HTTP_FOURCECREATE'); |
There was a problem hiding this comment.
Wrong spelling. Should be HTTP_FORCECREATE
| } | ||
| else | ||
| { | ||
| if ($fidentifier) |
There was a problem hiding this comment.
Why is this a different code path ? This is similar to creating a new user.
There was a problem hiding this comment.
Not clear on this. Will check this with you
Summary of Changes
These changes decouple the CRUD operation from users.php.
Also, following areas are improved