-
Notifications
You must be signed in to change notification settings - Fork 14
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
Hide custom groups from admin / users page #6
Comments
|
I tried several approaches, but none is satisfactory. One of the approaches adds a new method param Now I could first retrieve all groups and then filter them later in the UsersController or Group\Metadata which is used to populate the UI... |
Tentative PR here: owncloud/core#27184 |
or maybe we should just allow them to appear there... The one problem I see is that they are not distinguishable from regular groups. One idea would be to introduce the backend name, so it could appear as:
For this the backend id needs to be exposed to the UI code with a friendly name. But this brings other issues: the list of groups could become long and it would need to be searchable. That or simply have a checkbox for the admin "don't show groups from these backends: "... That would be close to what this PR does. However the groups would still appear in the provisioning API, and there there is also no information about what backend they come from... |
|
I think the group backend interface should include a The advantages I see with that approach:
|
Hmm, this might work I guess, I'll give it a try. I didn't like the idea of having a backend knowing about UI stuff, but there might be no other way. For now these are the subsystems I'd list:
@jvillafanez then the question is when exactly to call |
From a client's perspective, it should fetch all the groups from the manager and traverse the whole list checking the visibility. This is the least intrusive approach because there isn't any change in the manager. We could add another method in the manager to fetch the groups matching a filter (this new visiblity filter also included). This is a bit more optimum because it's expected the client will traverse a smaller group set. However, I'm not sure if this will be worthy for now because the optimization will rely on the number of items filtered out. |
Ok, thanks for the feedback. I think I'll go with the post-filter approach, basically a combination of:
That should do for now hopefully. |
Passing the current user might be useful. Backends could check if the user is an admin and decide to show all groups or a part of them, for example. |
Maybe. I had some thoughts and we need to make sure this stays compatible with the future "central group account table" like the "user account table" that is being done as part of owncloud/core#23558 The way I see it:
This means that filtering does happen in the group manager. I'll see if that is feasible. If not, then the less nice solution is to still do post-filtering: the UsersController of the users page would query which backends must be visible, then iterate over every group and call |
Maybe this can be refined to be called |
Damn... that's not enough. It is possible to remove these groups from the general result set (left sidebar in users page). But group memberships for custom groups are still visible. That's where filtering out gets more tricky because that information is cached. And if some API expects the membership to be there and the cache tells it doesn't, then 💥. So maybe for this specific purpose if a scope is given, then it doesn't cache the result. Needs further research. |
Here is where the user groups are fetched for the users page: https://github.com/owncloud/core/blob/master/settings/Controller/UsersController.php#L191. This leads to https://github.com/owncloud/core/blob/master/lib/private/Group/Manager.php#L260. Do you think it would make sense to add a I guess in general that the cache there is only meaningful for the current user's group memberships, and maybe some for sharing users, hmm... |
Preliminary work here for the |
I'd rather do the filtering outside of the manager for now. The manager's client will fetch all the groups with the usual search method (no need to change anything there), and then it will filter the results by itself. Something like:
Later we can add a specific method with the filtering included, which can handle the cache better. |
Yeah, I thought of post-filter, but it's not future proof regarding the future group account table. We'll need to rechange every location where we do post-filtering. In the meantime I just implemented this. It's ugly but it works... Look: https://github.com/owncloud/core/pull/27287/files#diff-93cb10073d420e1ba441767b3a1e6de7R262 I'll add another bit for the search code soon and then let this sleep for a bit... Hoping to find better insights in the next days. |
(we can always discard this PR if this is total bullshit) |
No description provided.
The text was updated successfully, but these errors were encountered: