permissions.py 658 B

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