Skip to content

User account table and user locking/blacklist #23558

Closed

Description

@karlitschek

User Account Table

Requirements

More and more features within ownCloud (either during migration or in live operations) require to list all users which are available in ownCloud. Especially during migration we have been heavily facing issues with user backend apps not being present and with bad performance impacts since the user information has to be queried from an external system which in addition leads to slower processing and latency. Especially the latency issue in the area of LDAP has been targeted by some bigger installations by heavy master slave ldap setups.
Futhermore any user related api we use requires pagination to allow proper low memory and low latency processing – nobody wants to load half a million user objects into ram before further processing. Proper pagination can only be implemented if all users are kept in one place.

Feature description

There will be a new table in the database oc_user_accounts. All user backends will be 'degraded' to authentication backends – we basically only need them to perform authentication.

1

2

The database design is influenced by one design decision we have to take: do we allow multiple authentications for one user? This would allow one user to login via ldap as well as shibboleth as well as user/password. As of today this is only possible for ldap and shibboleth because of we make sure that login names match up magically. Having multiple authentication mechanisms assigned to one account would leverage this to a more general approach.

Migration

Migration of the regular database user backend will happen during upgrade. Any other backend will need to use an occ command – this is necessary since this might take a very long time.
We can think about preparing a pre-script to be executed so that oc_user_accounts can apready be populated upfront.
The occ command will basically grab all users from a given user backend and move the information into the table oc_user_accounts.

Vcard handling and related functionalities

The user will maintain his vcard in the personal page. Upon change we will sync the vcard down to the system addressbook which is used for fed syncing of contacts.
The vcard will hold the avatar as well – for now we shall not touch the avatar handling, keep the current storage location and import the avatar into the vcard upon change.

locking/blacklisting

A new occ command will be added to lock and unlock a specific user. This can be used with a user account is locked in the backend LDAP but there are still valid PHP session open. A user who is blakclisted/locked/disabled can't do any action in ownCloud even if authenticated.

Design goal

We need to make sure that the IUserManager interface and all related interfaces stay untouched.
We will deprecate any interface which is related to the user backend.
We need to make sure that existing user backend implementation continue to work.
We should provide a general purpose tool which will migrate user accounts from any given user backend to the accounts table.

Open Questions

User management UI changes to deflect multiple auths mechanisms per user
touch group handling as well?
Arthur will provide a list of use cases about LDAP which need to be taken into account
How to sync heavy backends like LDAP with the user accounts table?
How do we perform the mapping of authentications to users?
Do we autoprovision a user as soon as it logs in?
Shall the migration touch sharing and other components already? As in move from legacy_login to the real it?

Activity

  1. karlitschek commented on Mar 24, 2016

    @karlitschek
    ContributorAuthor

    This should solve the invalidate session issue: #18410

  2. PVince81 commented on Mar 24, 2016

    @PVince81
    Contributor

    All user backends will be 'degraded' to authentication backends

    I think we also need the user backends to deliver the list of know users, if supported, so we can prepopulate the table (ex: LDAP).

    Some backends might not support browsing/searching users, something to keep in mind (and retest).

  3. PVince81 commented on Mar 24, 2016

    @PVince81
    Contributor

    Ref other ticket about the account table: #21282

  4. PVince81 commented on Mar 24, 2016

    @PVince81
    Contributor

    In case this wasn't considered yet, here were some other points from @blizzz #21282 (comment)

  5. blizzz commented on Mar 24, 2016

    @blizzz
    Contributor

    In case this wasn't considered yet, here were some other points from @blizzz #21282 (comment)

    Thanks for pointing at it @PVince81

    All user backends will be 'degraded' to authentication backends – we basically only need them to perform authentication.

    This sentence opens a nice box of topics to discuss, more than I have expected when I was doing #21282 (comment)

  6. PVince81 commented on Mar 29, 2016

    @PVince81
    Contributor

    @schiesbn also suggested using the carddav/system address book table which already contains all known users (that's the table used for syncing accounts between federated servers)

  7. added this to the milestone on Mar 30, 2016
  8. MTRichards commented on Mar 30, 2016

    @MTRichards
    Contributor

    Out of laziness reasons, these are screenshots.
    SO, we need to change the behavior of the disabled user flag so that it disables logins for the user. In addition, link shares, regular and federated shares become unavailable with a 503 error returned so the desktop clients don't delete all the files while it is disabled.

  9. MTRichards commented on Mar 30, 2016

    @MTRichards
    Contributor

    We would change the boolean to an int to cover more than two possible scenarios: Disabled, enabled, and disabled (shares available)

  10. PVince81 commented on Mar 30, 2016

    @PVince81
    Contributor
    • use mount id instead of home_dir
  11. PVince81 commented on Mar 30, 2016

    @PVince81
    Contributor
    • rename "legacy_login" to "user_id"
  12. PVince81 commented on Mar 30, 2016

    @PVince81
    Contributor
    • use "user_id" as primary key (see previous item), that one is not changeable
  13. 7 remaining items

  14. MTRichards commented on Apr 1, 2016

    @MTRichards
    Contributor

    This is what is being covered in 9.1: #18410

  15. modified the milestones: , on Apr 1, 2016
  16. self-assigned this
    on Jun 9, 2016
  17. PVince81 commented on Nov 30, 2016

    @PVince81
    Contributor

    Do we also need a central groups table ? From what I see every backend provides a dynamic list of their groups.

    Furthermore the groups logic is a bit worrying: the code seems to allow having the same group id coming from multiple backends, but so far it seems backends like LDAP does extra work to prevent duplicate ids. See #7918 (comment) for my research on groups.

  18. cdamken commented on Jan 3, 2017

    @cdamken
    Contributor

    Do we also need a central groups table ? From what I see every backend provides a dynamic list of their groups.

    could we try to have an occ ldap:update-group before the upgrade and while upgrading avoid to check the groups again?

  19. PVince81 commented on Feb 10, 2017

    @PVince81
    Contributor
    • "oc_user_accounts" needs a "backend_id" column to track from which backend the user was retrieved (ex: user_ldap)

    • rename "oc_user_accounts.legacy_login" to "oc_user_accounts.backend_user_id" which is the user id as delivered by the user backend

    • also add a table "oc_all_groups" that contains the groups imported from the different backends

      • id => primary key
      • backend_id => id of the backend from which the group was retrieved (ex: user_ldap)
      • backend_group_id => group id as delivered by the backend
      • display_name => group display name (display name is new in 10.0)
    • "oc_all_group_members" that contains group memberships

      • id => primary key
      • backend_group_id => id of the backend from which the group was retrieved (ex: user_ldap)
      • backend_user_id => user id as delivered by the backend
      • role (?) => for future subadmin role

    Goal is to be able to do quick search/lookup on the local table instead of contacting every backend every time we need such information.

    • discuss whether to keep oc_users and oc_groups which is the default local database backend manageable of users or merge it with the new table. I'd vote for keeping these for now. A bit of duplicate data though.
  20. PVince81 commented on Feb 14, 2017

    @PVince81
    Contributor

    use mount id instead of home_dir

    I mean the mount id from the "oc_mounts" table. But I don't think we can use it until we have oc_mounts as fstab: #26190

    Would still be good to have a direct connection to the oc_storages and/or oc_filecache of the user for easier joining. Could be possible over the oc_mounts table. Note that the table only populates after the first setupFS, so that column should be nullable.

  21. DeepDiver1975 commented on Feb 14, 2017

    @DeepDiver1975
    Contributor

    hmmm - but the mount_id is only available once the storage is initialized - which is at first login.
    But I'd like to set the home folder path at creation of the user. hmmmm

  22. PVince81 commented on Feb 14, 2017

    @PVince81
    Contributor

    Actually, by extension the oc_storages entry is also only created after the first login.
    So even the home folder path should be nullable until the user logs in.

    Because the home folder path might be computed based on LDAP attributes 🙈

  23. PVince81 commented on Feb 20, 2017

    @PVince81
    Contributor

    I suggest that for now we keep the "database user backend" as is and let the users page still drive that one. The account table logic will then sync users down from that backend.

    Maybe one different would be that we should fire events from backends whenever user/groups change to tell the account table to directly resync a specific user/group for immediate result. Such events might not apply for all backends. This would also be useful for the customgroups app when creating groups.

    Side note: assigning LDAP users to local groups must still be possible as it's a supported feature.

  24. PVince81 commented on Apr 11, 2017

    @PVince81
    Contributor

    Raised #27623 for the groups and gorup memberships part

  25. lock commented on Aug 2, 2019

    @lock

    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.

  26. locked as resolved and limited conversation to collaborators on Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions