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

Use PHP interfaces for user backends (and not implementsAction magic) #23421

Closed
MorrisJobke opened this issue Mar 21, 2016 · 14 comments
Closed

Comments

@MorrisJobke
Copy link
Contributor

MorrisJobke commented Mar 21, 2016

  • provide a proper interface for the user backend to be implemented
  • currently you need to implement some stuff of OCP\UserInterface (which should be named UserBackend), OC_User_Backend and some magic methods that are defined here:
    protected $possibleActions = array(
    self::CREATE_USER => 'createUser',
    self::SET_PASSWORD => 'setPassword',
    self::CHECK_PASSWORD => 'checkPassword',
    self::GET_HOME => 'getHome',
    self::GET_DISPLAYNAME => 'getDisplayName',
    self::SET_DISPLAYNAME => 'setDisplayName',
    self::PROVIDE_AVATAR => 'canChangeAvatar',
    self::COUNT_USERS => 'countUsers',
    );

We should move all of the implementsAction magic into proper interfaces that then could be checked on a language level rather than some magic methods that return a binary string to announce what is implemented.

cc @blizzz @butonic We talked about this already.

@DeepDiver1975
Copy link
Member

with 9.1 we want to introduce the central user account table - this will have major impact on the user backend interfaces - good point in time to cleanup

@DeepDiver1975 DeepDiver1975 added this to the 9.1-current milestone Mar 21, 2016
@DeepDiver1975 DeepDiver1975 self-assigned this Mar 21, 2016
@DeepDiver1975
Copy link
Member

move to 9.2

@DeepDiver1975 DeepDiver1975 modified the milestones: 9.2-next, 9.1-current Jun 9, 2016
@labkode
Copy link

labkode commented Nov 4, 2016

@DeepDiver1975 @MorrisJobke @PVince81
What is the best way to implement an IUserBackend and IGroupBackend ?
The solution we have now is a patch of the user_ldap app but we would like to have our own implementations easily attachable like the sharing provider.

Our implementation will retrieve users and groups from a custom service.

Thanks in advance

@DeepDiver1975
Copy link
Member

@labkode for user backend go this way:

class CernUserBackend implements \OCP\IUserBackend implements \OCP\UserBackend {
}

@DeepDiver1975
Copy link
Member

and for groups backend:

class CernGroupBackend implements \OCP\GroupInterface {
}

@labkode
Copy link

labkode commented Nov 7, 2016

@DeepDiver1975 Thanks a lot Thomas.
After implementing these interfaces, how can we connect them to ownCloud core?
I have found these two methods:

\OC::$server->getGroupManager()->addBackend(\OCP\GroupInterface);
\OC::$server->getUserManager()->registerBackend(\OCP\UserInterface);

Is this the correct way to include our implementation?

@DeepDiver1975
Copy link
Member

This is one option - but you can also use the config option - see https://github.com/owncloud/apps/tree/master/user_external#ftp

@labkode
Copy link

labkode commented Nov 7, 2016

Thanks Thomas, that makes much more sense

@labkode
Copy link

labkode commented Nov 8, 2016

@DeepDiver1975 Hi Thomas,

the user_external for users works really well out of the box, is there anything similar to plug-in our group backend with the same smoothness to avoid \OC::$server->getUserManager()->registerBackend(\OCP\UserInterface);?

@DeepDiver1975
Copy link
Member

the user_external for users works really well out of the box, is there anything similar to plug-in our group backend with the same smoothness to

no - not yet 🙈

@PVince81
Copy link
Contributor

PVince81 commented Dec 6, 2016

@jvillafanez oh, look what I found... as we were just talking about this in #26750

I see at least three interfaces:

  • methods for read-only group + members provider
  • methods for read-write group management
  • methods for read-write group members management

@jvillafanez
Copy link
Member

  • methods for read-write group management
  • methods for read-write group members management

I don't see an use case where different interfaces are needed for this. If you are able to create a group, you should be able to populate it. Although you could add members to existing groups even though you can't create new groups... 🤔

In any case, the naming and the inheritance tree (if any) must be as clear as possible.

@PVince81
Copy link
Contributor

PVince81 commented Apr 4, 2017

missed opportunity to cleanup.

Moving to backlog for now unless someone else finds time to clean this up as part of another task.

@stale
Copy link

stale bot commented Sep 21, 2021

This issue has been automatically closed.

@stale stale bot closed this as completed Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants