mirror of
https://github.com/fosrl/pangolin.git
synced 2026-10-15 00:59:04 +02:00
Support machine clients added to roles
This commit is contained in:
@@ -807,6 +807,27 @@ export const userOrgRoles = pgTable(
|
||||
(t) => [unique().on(t.userId, t.orgId, t.roleId)]
|
||||
);
|
||||
|
||||
// roles assigned to machine clients (clients with no userId) so they can be
|
||||
// granted access to site resources through roleSiteResources like users are
|
||||
export const clientOrgRoles = pgTable(
|
||||
"clientOrgRoles",
|
||||
{
|
||||
clientId: integer("clientId")
|
||||
.notNull()
|
||||
.references(() => clients.clientId, { onDelete: "cascade" }),
|
||||
orgId: varchar("orgId")
|
||||
.notNull()
|
||||
.references(() => orgs.orgId, { onDelete: "cascade" }),
|
||||
roleId: integer("roleId")
|
||||
.notNull()
|
||||
.references(() => roles.roleId, { onDelete: "cascade" })
|
||||
},
|
||||
(t) => [
|
||||
unique().on(t.clientId, t.orgId, t.roleId),
|
||||
index("idx_clientorgroles_roleid").on(t.roleId)
|
||||
]
|
||||
);
|
||||
|
||||
export const roleActions = pgTable(
|
||||
"roleActions",
|
||||
{
|
||||
@@ -2009,6 +2030,7 @@ export type UserInvite = InferSelectModel<typeof userInvites>;
|
||||
export type UserInviteRole = InferSelectModel<typeof userInviteRoles>;
|
||||
export type UserOrg = InferSelectModel<typeof userOrgs>;
|
||||
export type UserOrgRole = InferSelectModel<typeof userOrgRoles>;
|
||||
export type ClientOrgRole = InferSelectModel<typeof clientOrgRoles>;
|
||||
export type ResourceSession = InferSelectModel<typeof resourceSessions>;
|
||||
export type ResourcePincode = InferSelectModel<typeof resourcePincode>;
|
||||
export type ResourcePassword = InferSelectModel<typeof resourcePassword>;
|
||||
|
||||
Reference in New Issue
Block a user