Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Conversation

rullzer
Copy link
Member

@rullzer rullzer commented Oct 21, 2016

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzer rullzer added this to the Nextcloud 11.0 milestone Oct 21, 2016
@mention-bot
Copy link

@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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use #1705

Copy link
Member Author

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;
Copy link
Member

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)
Copy link
Member

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))
Copy link
Member

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',
Copy link
Member

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) {
Copy link
Member

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>
@blizzz
Copy link
Member

blizzz commented Oct 21, 2016

👎 too much bad code

#1728

@rullzer
Copy link
Member Author

rullzer commented Oct 21, 2016

@blizzz okidoki then I'll close this.

@rullzer rullzer closed this Oct 21, 2016
@rullzer rullzer deleted the oc_26341 branch October 21, 2016 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants