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

Add icon hints to share role descriptions #10832

Open
felix-schwarz opened this issue Jan 8, 2025 · 0 comments
Open

Add icon hints to share role descriptions #10832

felix-schwarz opened this issue Jan 8, 2025 · 0 comments

Comments

@felix-schwarz
Copy link

Is your feature request related to a problem? Please describe.

Clients that want to display an icon to visualize a share role currently have to hardcode a table that maps role UUIDs to icon names locally, as can be seen here:

IMO it counters the idea of having share roles returned by the server if clients still have to maintain and ship a list of role UUIDs to be able to "recognize" them and to present them in a visually appealing manner.

Describe the solution you'd like

The UnifiedRoleDefinitions returned by the permissions endpoint should add an extra property that provides hints as to which icon the client should use, like f.ex. eye, pencil, upload, shield.

A standard set of these icon names should be defined, so that clients can map them to local assets.

In order to allow new icons to be added over time, the icon hints should be provided as an array, with clients picking the first icon they know.

Put together, this could look like this:

{
  "@libre.graph.permissions.roles.allowedValues": [
    {
      "@libre.graph.weight": 1,
      "description": "Ansehen und herunterladen.",
      "displayName": "Kann anzeigen",
      "iconHints": [ "eye" ],
      "id": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"
    },
    {
      "@libre.graph.weight": 2,
      "description": "Ansehen, herunterladen und hochladen.",
      "displayName": "Kann hochladen",
      "iconHints": [ "upload-folder", "upload" ],
      "id": "1c996275-f1c9-4e71-abdf-a42f6495e960"
    },
    {
      "@libre.graph.weight": 3,
      "description": "Ansehen, herunterladen, hochladen, editieren, hinzufügen, löschen.",
      "displayName": "Kann bearbeiten",
      "iconHints": [ "pencil" ]
      "id": "fb6c3e19-e378-47e5-b277-9732f9de6e21"
    }
  ],
...

In this example the role with ID 1c996275-f1c9-4e71-abdf-a42f6495e960 introduces a new icon, upload-folder that older clients may not yet know. These clients can then fall back to the icon they have stored for upload.

Likewise, the server can introduce new roles and use the existing pool of icon hints - and clients will be able to show an icon for them without the need for source modification or a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant