forked from bai/curriculum-project-hub
fix(admin): let project MANAGE holders list teams for grants
GET /teams was org-admin only while team-access mutations require project MANAGE, so members with MANAGE saw an empty grant picker. Open the read-only team list to any org member and load it in the project page whenever the actor can manage the project.
This commit is contained in:
@@ -45,22 +45,19 @@
|
||||
const [p, a] = await Promise.all([api.project(slug, projectId), api.teamAccess(slug, projectId)]);
|
||||
proj = p;
|
||||
access = a.access;
|
||||
// Org-admin-only oversight sub-resources: sessions/teams/explorer are
|
||||
// not available to member-level project MANAGE holders.
|
||||
// Team list is needed for grant UI whenever the actor has project MANAGE
|
||||
// (org admin or member). Sessions/explorer stay org-admin oversight only.
|
||||
const needTeams = p.actorIsOrgAdmin === true || p.actorCanManageProject === true;
|
||||
const [s, t, e] = await Promise.all([
|
||||
p.actorIsOrgAdmin ? api.sessions(slug, projectId) : Promise.resolve({ sessions: [] as SessionSummary[] }),
|
||||
needTeams ? api.teams(slug) : Promise.resolve({ teams: [] as TeamRow[] }),
|
||||
p.actorIsOrgAdmin ? api.explorer(slug) : Promise.resolve(null as ExplorerData | null),
|
||||
]);
|
||||
sessions = s.sessions;
|
||||
teams = t.teams;
|
||||
explorer = e;
|
||||
if (p.actorIsOrgAdmin) {
|
||||
const [s, t, e] = await Promise.all([
|
||||
api.sessions(slug, projectId),
|
||||
api.teams(slug),
|
||||
api.explorer(slug),
|
||||
]);
|
||||
sessions = s.sessions;
|
||||
teams = t.teams;
|
||||
explorer = e;
|
||||
moveFolder = p.folderId ?? '';
|
||||
} else {
|
||||
sessions = [];
|
||||
teams = [];
|
||||
explorer = null;
|
||||
}
|
||||
} catch (err) {
|
||||
error = err instanceof Error ? err.message : String(err);
|
||||
|
||||
Reference in New Issue
Block a user