BobaBoard / issues

BobaBoard issue tracking
2 stars 0 forks source link

Create API endpoint to fetch roles assigned to the currently logged in user #137

Open essential-randomness opened 1 year ago

essential-randomness commented 1 year ago

See #https://github.com/BobaBoard/boba-components/issues/119 for the data that needs to be passed down to the frontend.

I think the endpoint should be users/@me/realms/:realm_id/roles. We also have /users/@me/pins/realms/{realm_id}, but I think there's an argument to be made that because a lot of user resources are depending on the specific realm, the realm should be the prefix in the URL. So:

etc.

For the data, I would structure it something like:

{
  roles: [{
    id,
    name,
    avatar,
    color,
    description,
    accessory,
    boards: [/*the ids of the boards this role applies to*/],
    permissions: {
      board_permissions: [/*the names of the permissions that apply to this role*],
      post_permissions: [/*the names of the permissions that apply to this role*],
      thread_permissions: [/*the names of the permissions that apply to this role*],
      realm_permissions: [/*the names of the permissions that apply to this role*],
    }
  }]
}

One relevant OpenAPI type:

We will need to create one for Role