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

Permission stratification #64

Open
nic-hartley opened this issue Dec 14, 2018 · 0 comments
Open

Permission stratification #64

nic-hartley opened this issue Dec 14, 2018 · 0 comments
Labels
discussion wanted We need to talk about this feature Something should be added
Milestone

Comments

@nic-hartley
Copy link
Member

BLOCKED until #18 is done

Goal

We currently have users and admins. We'll probably need more detailed levels of authorization to enable some of the other features.

Description

Currently, just having user/admin is fine, but to implement things like #62 and (potentially) giving donors more access than normal users we'll need to implement multiple layers, rather than just a boolean restricted/not.

I think at least four layers will be necessary:

  • User
  • Donator
  • Mod
  • Admin

What, exactly, each of these users can do is up for discussion, hence the tag.

Also worth noting is that any "greater" level can do everything that the lower levels can do, so a mod can implicitly do everything a donator can, whether or not they've actually donated.

Additional notes

This can probably done with:

enum PermissionLevels {
  USER,
  DONATOR,
  MOD,
  ADMIN
}
CREATE TYPE permission AS ENUM ('user', 'donator', 'mod', 'admin');

The order is important -- in PostgreSQL, values later in the list compare as > than values earlier in the list. As a trivial example, getting all people with donator privileges or above is just SELECT * FROM users WHERE permissions >= 'donator'.

@nic-hartley nic-hartley added feature Something should be added discussion wanted We need to talk about this labels Dec 14, 2018
@nic-hartley nic-hartley added this to the Beta milestone Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion wanted We need to talk about this feature Something should be added
Projects
None yet
Development

No branches or pull requests

1 participant