-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New command to update group mappings (#26341) #1840
Conversation
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzer, thanks for your PR! By analyzing the history of the files in this pull request, we identified @blizzz, @owncloud-bot and @nickvergessen to be potential reviewers. |
@@ -53,3 +53,4 @@ | |||
$application->add(new OCA\User_LDAP\Command\CheckUser( | |||
$uBackend, $helper, $deletedUsersIndex, $userMapping) | |||
); | |||
$application->add(new OCA\User_LDAP\Command\UpdateGroup(new LDAP(), $helper, $dbConnection)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use #1705
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me do that for LDAP in a new PR for all commands
*/ | ||
private function updateGroupMapping($groupName, $userList) { | ||
$query = $this->connection->getQueryBuilder(); | ||
$needToInsert = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed
$result = $query->select('*') | ||
->from('ldap_group_members') | ||
->where($query->expr()->eq('owncloudname', $query->createParameter('group'))) | ||
->setParameter('group', $groupName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use createNamedParameter($groupName)
to save one row for each usage?
->setValue('owncloudname', $query2->createParameter('group')) | ||
->setValue('owncloudusers', $query2->createParameter('users')) | ||
->setParameter('group', $groupName) | ||
->setParameter('users', serialize($userList)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please dont use serialize but json_encode/decode instead.
unserialize has security issues
->setName('ldap:update-group') | ||
->setDescription('update the specified group membership information stored locally') | ||
->addArgument( | ||
'groupID', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is off
const ERROR_CODE_MISSING_CONF = 1; | ||
const ERROR_CODE_MISSING_MAPPING = 2; | ||
|
||
public function __construct(LDAP $ldap, Helper $helper, IDBConnection $connection) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
👎 too much bad code |
@blizzz okidoki then I'll close this. |
See owncloud/core#26341
CC: @blizzz @MorrisJobke @nickvergessen