Skip to content

Commit 296840f

Browse files
committed
Hardcode legacy OrgMember.role=MEMBER on invite
UserRole is the source of truth for cloud; OSS doesn't need the legacy enum to carry the level. Drops the role-name lookup from member.server, which was the last place OSS had to know about specific role names.
1 parent c9923e8 commit 296840f

1 file changed

Lines changed: 1 addition & 19 deletions

File tree

apps/webapp/app/models/member.server.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -110,32 +110,14 @@ export async function inviteMembers({
110110
throw new Error("User does not have access to this organization");
111111
}
112112

113-
// The legacy OrgMember.role enum (ADMIN | MEMBER) needs a write so
114-
// pre-RBAC code paths still see a sensible role on the invite. Map by
115-
// role NAME — "Owner" and "Admin" become "ADMIN", everything else
116-
// becomes "MEMBER". This is the one place left where the OSS keys off
117-
// role names; the plugin owns the systemRoles catalogue and we just
118-
// match on the well-known legacy-equivalent labels here.
119-
// null means no plugin installed → default to "MEMBER" (legacy two-
120-
// option flow).
121-
const sys = await rbac.systemRoles(org.id);
122-
const adminEquivalent = new Set(
123-
(sys ?? [])
124-
.filter((r) => r.name === "Owner" || r.name === "Admin")
125-
.map((r) => r.id)
126-
);
127-
const legacyRole: "ADMIN" | "MEMBER" = adminEquivalent.has(rbacRoleId ?? "")
128-
? "ADMIN"
129-
: "MEMBER";
130-
131113
const invites = [...new Set(emails)].map(
132114
(email) =>
133115
({
134116
email,
135117
token: tokenGenerator(),
136118
organizationId: org.id,
137119
inviterId: userId,
138-
role: legacyRole,
120+
role: "MEMBER",
139121
rbacRoleId: rbacRoleId ?? null,
140122
} satisfies Prisma.OrgMemberInviteCreateManyInput)
141123
);

0 commit comments

Comments
 (0)