adjust citysite table name to activesites
This commit is contained in:
1 parent
fb0f996776
commit
64b37b6b6d
27 files changed
+382
-221
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
Settled matrix (v1):
|
||||
- buh, director (+ their admins until specified otherwise): view only
|
||||
- gm + gm_admin: view + register city sites (URL) + sync from cities
|
||||
- gm + gm_admin: view + register active sites (URL) + sync from sites
|
||||
- gm only (not gm_admin): approve cycle close
|
||||
"""
|
||||
|
||||
@@ -22,7 +22,7 @@ VIEW_ONLY_STATUSES = frozenset(
|
||||
}
|
||||
)
|
||||
|
||||
# Can register city dashboard URLs into the HQ mirror registry.
|
||||
# Can register site dashboard URLs into the HQ mirror registry.
|
||||
SITE_REGISTRY_STATUSES = frozenset(
|
||||
{
|
||||
User.STATUS_GM,
|
||||
@@ -30,7 +30,7 @@ SITE_REGISTRY_STATUSES = frozenset(
|
||||
}
|
||||
)
|
||||
|
||||
# Can trigger city → HQ mirror sync.
|
||||
# Can trigger site → HQ mirror sync.
|
||||
SYNC_STATUSES = frozenset(
|
||||
{
|
||||
User.STATUS_GM,
|
||||
@@ -73,8 +73,8 @@ def can_sync(user) -> bool:
|
||||
)
|
||||
|
||||
|
||||
def can_register_city_site(user) -> bool:
|
||||
"""GM / GM Admin may add city dashboard URLs to the HQ registry."""
|
||||
def can_register_active_site(user) -> bool:
|
||||
"""GM / GM Admin may add site dashboard URLs to the HQ registry."""
|
||||
return bool(
|
||||
user
|
||||
and getattr(user, "is_authenticated", False)
|
||||
@@ -105,9 +105,9 @@ def can_manage_users(user) -> bool:
|
||||
return _status(user) in USER_ADMIN_STATUSES
|
||||
|
||||
|
||||
def can_manage_city_registry(user) -> bool:
|
||||
"""Alias used by city-site write endpoints — same as register permission."""
|
||||
return can_register_city_site(user) or bool(getattr(user, "is_superuser", False))
|
||||
def can_manage_active_site_registry(user) -> bool:
|
||||
"""Alias used by active-site write endpoints — same as register permission."""
|
||||
return can_register_active_site(user) or bool(getattr(user, "is_superuser", False))
|
||||
|
||||
|
||||
class IsExecutive(permissions.BasePermission):
|
||||
@@ -120,9 +120,9 @@ class IsExecutiveAdmin(permissions.BasePermission):
|
||||
return can_manage_users(request.user)
|
||||
|
||||
|
||||
class CanRegisterCitySite(permissions.BasePermission):
|
||||
class CanRegisterActiveSite(permissions.BasePermission):
|
||||
def has_permission(self, request, view):
|
||||
return can_register_city_site(request.user) or bool(
|
||||
return can_register_active_site(request.user) or bool(
|
||||
getattr(request.user, "is_superuser", False)
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user