Skip to content

Conversation

@juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Oct 10, 2018

This adds a readonly API to public namespace to allow apps to access the user account data.

Todo:

  • Add tests

@juliusknorr juliusknorr added this to the Nextcloud 15 milestone Oct 10, 2018
@juliusknorr juliusknorr force-pushed the feature/noid/account-api branch from 0055170 to 7982943 Compare October 10, 2018 14:40
Copy link
Member

@ChristophWurst ChristophWurst left a 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 😉

use OCP\Accounts\IAccountProperty;
use OCP\IUser;

class Account implements IAccount, \JsonSerializable {
Copy link
Member

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

Copy link
Member Author

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.

@juliusknorr juliusknorr force-pushed the feature/noid/account-api branch from 7982943 to d395235 Compare October 10, 2018 17:25
@juliusknorr
Copy link
Member Author

I know, I know, this is not labeled to be reviewed yet, but I couldn't resist to give feedback

Totally fine for me 😉

@juliusknorr juliusknorr added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Oct 11, 2018
@juliusknorr
Copy link
Member Author

Ready for review.

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

Looks good otherwise :)

}

public function getFilteredProperties(string $scope = null, string $verified = null): array {
return \array_filter($this->properties, function($obj) use ($scope, $verified){
Copy link
Member

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

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?

Copy link
Member Author

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.

@juliusknorr juliusknorr force-pushed the feature/noid/account-api branch from a664817 to 63ae96c Compare October 11, 2018 13:41
Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

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

Cool stuff!

Copy link
Member

@ChristophWurst ChristophWurst left a 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 :)

@juliusknorr juliusknorr force-pushed the feature/noid/account-api branch from 63ae96c to aacec01 Compare October 12, 2018 07:31
@juliusknorr
Copy link
Member Author

@ChristophWurst Squashed them 😉

@ChristophWurst ChristophWurst added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Oct 12, 2018
@MorrisJobke

This comment has been minimized.

@juliusknorr juliusknorr force-pushed the feature/noid/account-api branch from aacec01 to ea75eab Compare October 12, 2018 09:17

public function testConstructor() {
$accountProperty = new AccountProperty(
AccountManager::PROPERTY_WEBSITE,
Copy link
Member

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?

Copy link
Member

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. 😉

Copy link
Member Author

Choose a reason for hiding this comment

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

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>
@juliusknorr juliusknorr force-pushed the feature/noid/account-api branch from ea75eab to b9a87a6 Compare October 15, 2018 11:30
@juliusknorr
Copy link
Member Author

Failing tests unrelated:

sh: 1: kill: No such process

@rullzer rullzer merged commit 5aaa8a8 into master Oct 15, 2018
@rullzer rullzer deleted the feature/noid/account-api branch October 15, 2018 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants