feat: enhance admin user management and profile updates
- Added role and tier fields to the ProfileUpdate model, allowing for better user role management. - Implemented new API endpoint for listing admin users, accessible only to portal admins. - Updated profile retrieval and update logic to handle role and tier changes, enforcing permissions for modifications. - Enhanced frontend navigation and routing to include the new admin users page, improving admin interface usability. - Bumped application version to 0.8.19 and updated changelog to reflect these changes.
This commit is contained in:
1 parent
0f08e8df58
commit
9afcd762d0
11 files changed
+574
-11
No files matched your search
@@ -68,10 +68,12 @@ def can_plan_in_club(cur, profile_id: int, club_id: int, global_role: Optional[s
|
||||
)
|
||||
|
||||
|
||||
def memberships_with_roles(cur, profile_id: int) -> List[Dict[str, Any]]:
|
||||
def memberships_with_roles(cur, profile_id: int, active_only: bool = True) -> List[Dict[str, Any]]:
|
||||
status_filter = "AND cm.status = 'active'" if active_only else ""
|
||||
cur.execute(
|
||||
"""
|
||||
f"""
|
||||
SELECT c.id, c.name, c.abbreviation, c.status,
|
||||
cm.status AS membership_status,
|
||||
COALESCE(
|
||||
ARRAY_AGG(DISTINCT r.role_code) FILTER (WHERE r.role_code IS NOT NULL),
|
||||
ARRAY[]::varchar[]
|
||||
@@ -79,8 +81,8 @@ def memberships_with_roles(cur, profile_id: int) -> List[Dict[str, Any]]:
|
||||
FROM club_members cm
|
||||
INNER JOIN clubs c ON c.id = cm.club_id
|
||||
LEFT JOIN club_member_roles r ON r.club_member_id = cm.id
|
||||
WHERE cm.profile_id = %s AND cm.status = 'active'
|
||||
GROUP BY c.id, c.name, c.abbreviation, c.status
|
||||
WHERE cm.profile_id = %s {status_filter}
|
||||
GROUP BY c.id, c.name, c.abbreviation, c.status, cm.status
|
||||
ORDER BY c.name
|
||||
""",
|
||||
(profile_id,),
|
||||
|
||||
Reference in new issue
Block a user