owncloud / web

:dragon_face: Next generation frontend for ownCloud Infinite Scale
https://owncloud.dev/clients/web/
GNU Affero General Public License v3.0
443 stars 157 forks source link

[SharingNG] Unified Roles are not sorted by weight #11915

Open micbar opened 5 hours ago

micbar commented 5 hours ago

Describe the bug

Sharing roles are not sorted by weight in the dropdown. The libregraph API provides a sorting by weight, which should be respected in the clients.

Steps to reproduce

  1. Create Folder
  2. Open Network tab
  3. Click quick action "Share"
  4. Select Sharee
  5. Open Sharing Role Dropdown

Expected behavior

Items in the dropdown should be sorted by weight.

Actual behavior

Sorting is kind of random

Setup

Ocis 7.0.0-rc.2

Screenshot

Unified Roles Sorting

micbar commented 5 hours ago

@AlexAndBear @JammingBen I hope this is just a small fix.

Maybe we failed to communicate the expectation.

AlexAndBear commented 4 hours ago

@micbar does the roleManagement/permissions/roleDefinitions does support any orderBy or sortBy query param? If no, can you make it happen ?

micbar commented 4 hours ago

@micbar does the roleManagement/permissions/roleDefinitions does support any orderBy or sortBy query param? If no, can you make it happen ?

I do not understand that correctly. The individual permissions call on the resource has the weight property. What is missing there?

AlexAndBear commented 4 hours ago

@micbar does the roleManagement/permissions/roleDefinitions does support any orderBy or sortBy query param? If no, can you make it happen ?

I do not understand that correctly. The individual permissions call on the resource has the weight property. What is missing there?

We fetch and persist the roles from the /roleDefinitions endpoint rather from the /permissions endpoint shown in your example, I was wondering if I can sort them via a query param on the endpoint rather than sorting in the client

micbar commented 4 hours ago

We fetch and persist the roles from the /roleDefinitions endpoint rather from the /permissions endpoint shown in your example, I was wondering if I can sort them via a query param on the endpoint rather than sorting in the client

Hmm, so you are not context sensitive? IMHO we should respect the weight property from the permissions call

"@libre.graph.permissions.roles.allowedValues": [
        {
            "@libre.graph.weight": 1,
            "description": "Ansehen und herunterladen.",
            "displayName": "Kann anzeigen",
            "id": "a8d5fe5e-96e3-418d-825b-534dbdf22b99"
        },
        {
            "@libre.graph.weight": 2,
            "description": "Ansehen, herunterladen, hochladen, editieren, hinzufügen, löschen.",
            "displayName": "Kann bearbeiten ohne Historie",
            "id": "3284f2d5-0070-4ad8-ac40-c247f7c1fb27"
        },
        {
            "@libre.graph.weight": 3,
            "description": "Ansehen, herunterladen, hochladen, bearbeiten, hinzufügen, löschen - inklusive der Historie.",
            "displayName": "Kann bearbeiten",
            "id": "58c63c02-1d89-4572-916a-870abc5a1b7d"
        },
        {
            "@libre.graph.weight": 4,
            "description": "Ansehen, herunterladen, hochladen, bearbeiten, hinzufügen, löschen, teilen und Mitglieder verwalten.",
            "displayName": "Kann verwalten",
            "id": "312c0871-5ef7-4b3a-85b6-0e4074c64049"
        }
    ],

They are always sorted correctly for the current resource and have a weight property. The "/roleDefinitions" is called during bootstrap AFAICT and not called again, so it is not context aware.

AlexAndBear commented 4 hours ago

I am fine, sorting will take place in frontend, pr is linked 👍