permissions.py 577 B

123456789101112131415161718
  1. from glitchtip.permissions import ScopedPermission
  2. class ProjectPermission(ScopedPermission):
  3. scope_map = {
  4. "GET": ["project:read", "project:write", "project:admin"],
  5. "POST": ["project:write", "project:admin"],
  6. "PUT": ["project:write", "project:admin"],
  7. "DELETE": ["project:admin"],
  8. }
  9. def get_user_scopes(self, obj, user):
  10. return obj.organization.get_user_scopes(user)
  11. class ProjectKeyPermission(ProjectPermission):
  12. def get_user_scopes(self, obj, user):
  13. return obj.project.organization.get_user_scopes(user)