permissions.py 566 B

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