crusttech / crust-server

Apache License 2.0
87 stars 21 forks source link

Messaging permissions API #30

Closed titpetric closed 5 years ago

titpetric commented 5 years ago

There's an outline of a permissions api already specified. It needs to be extended in the following ways:

  1. internal/rules/operations.go

    • delete Permission{} if possible, it's invalid (we don't deal with "Scope", we have Rules{},
    • update API spec.json to use "[]rules.Rules" as well (keep TeamID as separate parameter)

So, the main point here is to have a unique data structure to read/save our permissions structure. A permission is defined for a [TeamID] over [ResourceID, Operation string, Access], so API calls for saving should use TeamID+[]Rules, while reading may only return "[]Rules".

  1. internal/rules/interfaces.go

    • change parameter order for Grant, ListGrants (teamID should be first param)

Simple ordering fix, we're granting Teams permissions on Resource,...

  1. extend API to retrieve Resources available
    • we return default scopes for organisation (from list, defined here)
    • we need an API call which will return available resources from scope name (list orgs, teams, channels), e.g. /permissions/scopes/{scope} - new API

So, the intent here is to have a Messaging navigation in the Administration panel where you would have 3 sub-menus for each scope - Org, Team, Channel; In the Team views and Organisation views the administrator must select a Team or Channel for which he wants to view / change permissions.

  1. cosmetic: drop types from API names ("getTeam" => "get", see other spec.json examples for "name"...)

All of these are non-blocking and needed for the admin panel interface. Here's the trello link with more info and screenshots.

mitjaziv commented 5 years ago

Points 1,2 and 4 are implemented.

darh commented 5 years ago

Implemented & mostly obsolete.