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

add method to query all user auth tokens #24686

Merged
merged 1 commit into from
May 19, 2016
Merged

Conversation

ChristophWurst
Copy link
Contributor

required for #24675 and the personal settings page PR I'm working on

@MorrisJobke @PVince81 @nickvergessen @rullzer

@ChristophWurst ChristophWurst added this to the 9.1-current milestone May 18, 2016
->where($qb->expr()->eq('uid', $qb->createParameter('uid')))
->setParameter('uid', $user->getUID())
->execute()
->fetchAll();
Copy link
Contributor

Choose a reason for hiding this comment

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

please dont chain everything.
execute() returns a different object, so please use a new variable.
also you should closeCursor() on that new object.

@nickvergessen
Copy link
Contributor

What happens if a user has thousands of devices? does it make sense to limit the return?
So we don't run into the same problem like we have with background jobs, where you
have 20k and your system runs out of memory.
Since we are introducing a new API here, we can easily say that it will only return the first ~1k entries

@ChristophWurst
Copy link
Contributor Author

What happens if a user has thousands of devices? does it make sense to limit the return?

Are you talking about simply not showing more than X entries or pagination? As discussed with @PVince81 yesterday, we think pagination won´t be needed here assuming users won't have 20k connected clients.

@nickvergessen
Copy link
Contributor

Hard limit, this is only about an abuse case, but we want to make sure, that an abuser can still be listed and dealt with.

@ChristophWurst
Copy link
Contributor Author

@nickvergessen what kind of abuse are you talking about? Someone creating a large number of tokens?

@@ -83,4 +84,28 @@ public function getToken($token) {
return DefaultToken::fromRow($data);
}

/**
* Get all token of a user
Copy link
Contributor

Choose a reason for hiding this comment

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

does not match interface

Copy link
Contributor Author

Choose a reason for hiding this comment

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

which interface?

Copy link
Contributor

Choose a reason for hiding this comment

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

its missing the warning

 * The provider may limit the number of result rows in case of an abuse
 * where a high number of (session) tokens is generated

If you don't want to repeat yourself, use

/**
 * {@inheritdoc}
 */

https://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.inlineinheritdoc.pkg.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please check again, there is no interface the mapper implements. DefaultTokenProvider implements IProvider and has the right doc block 😉

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I ment lib/private/Authentication/Token/DefaultTokenProvider.php well then copy the doc lines from there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added…

@ChristophWurst ChristophWurst force-pushed the query-user-authtokens branch 3 times, most recently from ec0dd9c to 2572192 Compare May 18, 2016 12:21
@nickvergessen
Copy link
Contributor

Looks good now 👍

@MorrisJobke
Copy link
Contributor

Looks really good 👍

@PVince81
Copy link
Contributor

Come on, Jenkins. 4 hours and still no results ?

@ChristophWurst mind rebasing and repushing to kick his butt ?

@ChristophWurst
Copy link
Contributor Author

kick his butt

kicked

@PVince81 PVince81 merged commit e1a9a26 into master May 19, 2016
@PVince81 PVince81 deleted the query-user-authtokens branch May 19, 2016 08:28
@lock
Copy link

lock bot commented Aug 5, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants