-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Public API to get user acocunt data #11740
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
Conversation
0055170 to
7982943
Compare
ChristophWurst
left a comment
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.
I know, I know, this is not labeled to be reviewed yet, but I couldn't resist to give feedback 😉
lib/private/Accounts/Account.php
Outdated
| use OCP\Accounts\IAccountProperty; | ||
| use OCP\IUser; | ||
|
|
||
| class Account implements IAccount, \JsonSerializable { |
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.
FYI: if the JSON serialization should also be available for apps, the public interface should extend JsonSerializable
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.
Yes, makes sense to have it in the interface of course.
7982943 to
d395235
Compare
Totally fine for me 😉 |
|
Ready for review. |
ChristophWurst
left a comment
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.
Looks good otherwise :)
lib/private/Accounts/Account.php
Outdated
| } | ||
|
|
||
| public function getFilteredProperties(string $scope = null, string $verified = null): array { | ||
| return \array_filter($this->properties, function($obj) use ($scope, $verified){ |
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.
you can typehint the $obj type here
|
|
||
| public function jsonSerialize() { | ||
| return [ | ||
| 'value' => $this->value, |
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.
name missing. was that intentional?
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.
The name is always available from the data given by the Account class, but yes, it makes sense to have it in the serialized array as well.
a664817 to
63ae96c
Compare
rullzer
left a comment
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.
Cool stuff!
ChristophWurst
left a comment
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.
Looks great 👍
I'd appreciate if you could squash your commits :)
63ae96c to
aacec01
Compare
|
@ChristophWurst Squashed them 😉 |
This comment has been minimized.
This comment has been minimized.
aacec01 to
ea75eab
Compare
|
|
||
| public function testConstructor() { | ||
| $accountProperty = new AccountProperty( | ||
| AccountManager::PROPERTY_WEBSITE, |
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.
should use them from IAccountManager to make sure they are not removed there?
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.
@juliushaertl Mind to look into this final comment and then we can merge this. 😉
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.
@nickvergessen Done.
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
ea75eab to
b9a87a6
Compare
|
Failing tests unrelated:
|
This adds a readonly API to public namespace to allow apps to access the user account data.
Todo: