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

EntitiesManager #15357

Closed
wants to merge 2 commits into from
Closed

EntitiesManager #15357

wants to merge 2 commits into from

Conversation

ArtificialOwl
Copy link
Member

@ArtificialOwl ArtificialOwl commented May 3, 2019

#13478: EntitiesManager
Fix #10292

You need to run git submodule update !

⚠️ Note about Visibility ⚠️

Currently, the visibility of all groups is a checkbox to allow sharing from people outside a group to the people within a group. This will be changed in EntitiesManager:

  • on migration, the settings will be used when create new Entities, based on the existing groups
  • then, default visibility on group creation will be based on a setting.
  • visibility of a group can be switched per group, not a global value anymore.

@ArtificialOwl ArtificialOwl added the 2. developing Work in progress label May 3, 2019
@skjnldsv skjnldsv changed the title EntitesManager EntitiesManager May 3, 2019
@ArtificialOwl
Copy link
Member Author

ArtificialOwl commented May 28, 2019

Status update about EntitiesManager. Please note that this is a WIP and the main purpose of the command lines is to test and see how everything handling together.

Missing features:

  • Comments
  • Viewer and Visibility.
  • Access, Request and Invites
  • Limit to the number of member in an entity.
  • Entity as Member of an entity.
  • Migrate Circles.
  • check old settings about visibility when migrating groups.

./occ entities:install

will reset all data from the entities_* tables and create the basic implementation of the interfaces used to manage entities and accounts:

Selection_046

A quick overview on the basic implementations:

  • implementations of IEntities:

    • 'User' represents a single local user with access to the Nextcloud, it is using the 'LocalUser' implementation of IEntitiesAccounts for the identification of the Nextcloud account (set as the 'Owner' of the 'User'). The display name is saved here during the migration so it is available in the search process.
    • 'Account' represents an account with no access to Nextcloud and limited to the visibility of the 'Owner' only.
    • 'Group' manage a list of accounts.
    • 'AdminGroup' manage a list of accounts with Nextcloud admin rights.
  • implementations of IEntitiesAccounts:

  • 'LocalUser': used by 'User' entities to identify local accounts,
  • 'MailAddress': any email address. If multiple users adds the same mail address as contact, we will have one unique entry as entities_accounts and as many entries as needed as entities.

Visibility, membership and ownership will be used when searching for a contact/account/group when sharing an object (file ?).
Of course, any 'out-of-the-box user management' app will be able to add their own implementation.

./occ entities:migration

will migrate current users and groups into the Entities Manager.

Selection_044

This example shows all type of Ids used in the Entities Manager:

  • EntityIds are used to identify any entity, could be a single local user and its account, a 'non-local' account, or a group/cluster/list of any type of accounts.
    The EntityId will helps to identify a list of users from any upper layer; it will be used for shares, chatroom members, access rights, resharing rights but also Nextcloud Admin rights. (Please note that the list is not comprehensive)
    A Visibility and a Access flag are assigned to EntityIds.

  • AccountIds are used to identify accounts in the Entities Manager.
    Please remember that an account in the entity manager is NOT an account on the Nextcloud. However, the list of 'local users' in the entities manager can be used by lower layer to allow/provide access to the Nextcloud. This would require some small edits but in the long term a migration to use the entity manager in the auth/login process could be imaginated.

  • MemberIds will mostly be used within the Entities Manager, it is the link between EntityId and AccountId.
    A Level and a Status is assigned to MemberIds.

./occ entities:manage:create

a command line to create entity, account or member. The basic syntax is:

./occ entities:manage:create item type

item can be entity, account or member
type will depend on the item itself, and available type will be displayed:

Selection_050

Based on the chosen item, some Options are available (and some are mandatory):

  • entity will accept --name, --access, --visibility, --owner
  • account will require --account
  • member will accept --account, --slave, --entity, --level

As an example, we will add a Mail account in the database.

Selection_051

As a side note, the duplicity is managed by the implementation of the IEntitiesAccountsSearchDuplicate interface. Our class MailAddress check if type and account does not exists already:

Selection_048

Once the Mail account is added to the database, we will create an entity that will allow the 'cult' user to search for this mail address when sharing a file:

    ./occ entities:manage:create entity account --owner ACCOUNT_ID \
      --name "Maxence Lange <[email protected]>" \
      --access limited --visibility none

Selection_054

Then, we add the account of the mail address as a normal member of the generated entity.

  ./occ entities:manage:create member member --level member \
     --entity ENTITY_ID --account ACCOUNT_ID

Selection_056

./occ entities:search

Used to search an entity. This is the typical result to be expected when sharing a file:

Selection_059

It can also be used to search for an account:

Selection_061

./occ entities:details

returns details about an entity or an account:

Selection_060

Selection_062

@MorrisJobke
Copy link
Member

Need to add "daita/nc-small-php-tools": "v1.0.4" to composer in 3rdparty.

Then do this - add a PR to the 3rdparty repo, check out the branch in the server repo's 3rdparty folder and add this updated submodule to this PR here. Then for testing only "git submodule update" is needed 😉

@MorrisJobke MorrisJobke added this to the Nextcloud 17 milestone May 31, 2019
@ArtificialOwl
Copy link
Member Author

@MorrisJobke will do. I just wanted a quick review/first tests before adding 3rd party to the core !

@ArtificialOwl ArtificialOwl force-pushed the enhancement/13478/entities branch from f0e7da5 to 6b0bd20 Compare June 3, 2019 16:38
@ArtificialOwl
Copy link
Member Author

ArtificialOwl commented Jun 4, 2019

Viewers and Visibility is a thing when using the ./occ entities:search command:

using an admin account:

Selection_066

using a non-admin temporary random account:
Selection_065

@ArtificialOwl ArtificialOwl force-pushed the enhancement/13478/entities branch 2 times, most recently from f3fdb73 to c8bf016 Compare June 10, 2019 11:33
@ArtificialOwl ArtificialOwl force-pushed the enhancement/13478/entities branch from b89a46a to 3c524eb Compare June 21, 2019 17:08
Signed-off-by: Maxence Lange <[email protected]>
some more

Signed-off-by: Maxence Lange <[email protected]>
fixing stuff, better details

Signed-off-by: Maxence Lange <[email protected]>
still working on details

Signed-off-by: Maxence Lange <[email protected]>
details on members

Signed-off-by: Maxence Lange <[email protected]>
--short option

Signed-off-by: Maxence Lange <[email protected]>
create entities from command line

Signed-off-by: Maxence Lange <[email protected]>
cleaner way to check for owner

Signed-off-by: Maxence Lange <[email protected]>
search within accounts

Signed-off-by: Maxence Lange <[email protected]>
import displayName during migration

Signed-off-by: Maxence Lange <[email protected]>
display result in table

Signed-off-by: Maxence Lange <[email protected]>
admin right, some cleaning and sql logging

Signed-off-by: Maxence Lange <[email protected]>
add comments to sql log

Signed-off-by: Maxence Lange <[email protected]>
log exception from sql execution

Signed-off-by: Maxence Lange <[email protected]>
fixing and cleaning !

Signed-off-by: Maxence Lange <[email protected]>
fixing

Signed-off-by: Maxence Lange <[email protected]>
generate viewer and caching data

Signed-off-by: Maxence Lange <[email protected]>
cleaning

Signed-off-by: Maxence Lange <[email protected]>
limit visibility

Signed-off-by: Maxence Lange <[email protected]>
fixing default visibility on local user entity

Signed-off-by: Maxence Lange <[email protected]>
options and visibility level for admin

Signed-off-by: Maxence Lange <[email protected]>
better way to test EM

Signed-off-by: Maxence Lange <[email protected]>
new Session command

Signed-off-by: Maxence Lange <[email protected]>
nc-small-php-tools

Signed-off-by: Maxence Lange <[email protected]>
fix creation+deleteOn

Signed-off-by: Maxence Lange <[email protected]>
@ArtificialOwl ArtificialOwl force-pushed the enhancement/13478/entities branch from 3c524eb to 4b79a8d Compare June 21, 2019 17:09
Signed-off-by: Maxence Lange <[email protected]>
@MorrisJobke
Copy link
Member

Let's move this to 18.

@ChristophWurst ChristophWurst removed their request for review August 6, 2019 12:52
@ArtificialOwl ArtificialOwl removed this from the Nextcloud 18 milestone Dec 5, 2019
@rullzer
Copy link
Member

rullzer commented Mar 30, 2021

I'm going to close this due to lack of activity.
Feel free to reopen if anybody wants to continue.

@rullzer rullzer closed this Mar 30, 2021
@rullzer rullzer deleted the enhancement/13478/entities branch March 30, 2021 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generic share API to share files with apps
3 participants