chronograf icon indicating copy to clipboard operation
chronograf copied to clipboard

As a user I can set the role of a user

Open nhaugo opened this issue 9 years ago • 10 comments

Role should have no effect but simply be assigned to the user.

Current roles are Superadmin, admin, editor and viewer.

nhaugo avatar Aug 08 '17 01:08 nhaugo

chronograf-web-admin-2

NOTES

  • Follows same table edit paradigm from existing admin page
  • When hovering over a row:
    • Role becomes dropdown, enables assignment of new role
    • Delete user link appears on rightmost cell
  • When Create User is clicked:
    • Create new role at the top of the table
    • Editable fields for Username & Email Address
    • Role dropdown has default value specified via org settings ( #1831 )
    • Save/Cancel buttons in rightmost cell
  • Roles & Permissions column is just for reference
    • Each section accordions open

alexpaxton avatar Aug 17 '17 20:08 alexpaxton

  • [x] Define roles and permissions in the context of Chronograf, a la source users (check out InfluxDB and Enterprise implementations for reference)

jaredscheib avatar Oct 09 '17 22:10 jaredscheib

// Permissions

Permission:
  Scope: "dashboards"
  Name: DashboardRead
  Allowances: "read"

Permission:
  Scope: "dashboards"
  Name: DashboardWrite
  Allowances: "write"

Permission:
  Scope: "sources"
  Allowances: "read"

Permission:
  Scope: "sources"
  Allowances: "write"

Permission:
  Scope: "rules"
  Allowances: "read"

Permission:
  Scope: "rules"
  Allowances: "write"

Permission:
  Scope: "users"
  Allowances: "read"

Permission:
  Scope: "users"
  Allowances: "write"

// Implement Later
Permission:
  Scope: "organization"
  Allowances: "access"

Permission:
  Scope: "organization"
  Allowances: "write"

Permission:
  Scope: "organizations"
  Allowances: "read"

Permission:
  Scope: "organizations"
  Allowances: "write"
// Roles

// User's current org is higher order logic
Role:
  Name: Viewer
  Permissions: DashboardRead, SourceRead, RuleRead

Role:
  Name: Editor
  Permissions: Viewer, DashboardWrite, SourceWrite, RuleWrite

// Implement Later
Role:
  Name: Admin
  Permissions: Editor, UsersRead/Write, (OrganizationReadWrite?)

Role:
  Name: SuperAdmin
  Permissions: Admin, OrganizationsRead/Write

@goller something like this seem reasonable?

desa avatar Oct 10 '17 22:10 desa

And then the next step seems to be creating a RolesStore implementation for Bolt, to store the Roles, such that a User's Role can be set.

jaredscheib avatar Oct 10 '17 22:10 jaredscheib

@desa LGTM

goller avatar Oct 11 '17 14:10 goller

We modified the plan to have Roles be on the User and setting roles by updating the User.

jaredscheib avatar Oct 13 '17 00:10 jaredscheib

@desa @jaredscheib we don't need all these roles. See the first comment

nhaugo avatar Oct 13 '17 22:10 nhaugo

We've only implemented Admin, Editor, and Viewer so far. They require a concept of Permissions in order to reuse and conform to interfaces and structs that are already in place.

jaredscheib avatar Oct 13 '17 22:10 jaredscheib

@jaredscheib after discussion with @nhaugo and @goller we're going to remove the granularity of the permissions, so there will be a

View Permission

Which can read dashboards, sources, and rules

Edit Permission

Which can read and write dashboards, sources, and rules

Admin Permission

Which can read and write dashboards, sources, users, and rules

SuperAdmin Permission

Which can read and write dashboards, sources, users, organizations, and rules

The reason for this is so that we don't have to live with fine-grained permissions. Start course, add granularity when we have to.

desa avatar Oct 13 '17 22:10 desa

Whether this is encoded in the logic that authorizes a User for a particular resource, or decoded via explicit Permissions as in the above, the same amount of granularity seems to me to be required in order to perform Viewer, Editor, Admin, and SuperAdmin roles as specified.

I don't have a strong opinion about whether to encode or decode them, but this work is already done and feels more extensible. If we want to go a different path, that's fine with me too.

jaredscheib avatar Oct 14 '17 00:10 jaredscheib