mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 07:28:21 +00:00
fix: broken custom role in group
This commit is contained in:
@@ -17,14 +17,14 @@ export const permissionDALFactory = (db: TDbClient) => {
|
|||||||
const getOrgPermission = async (userId: string, orgId: string) => {
|
const getOrgPermission = async (userId: string, orgId: string) => {
|
||||||
try {
|
try {
|
||||||
const groupSubQuery = db(TableName.Groups)
|
const groupSubQuery = db(TableName.Groups)
|
||||||
.where({ orgId })
|
.where(`${TableName.Groups}.orgId`, orgId)
|
||||||
.join(TableName.UserGroupMembership, (qb) => {
|
.join(TableName.UserGroupMembership, (qb) => {
|
||||||
qb.on(`${TableName.UserGroupMembership}.groupId`, `${TableName.Groups}.id`).andOn(
|
qb.on(`${TableName.UserGroupMembership}.groupId`, `${TableName.Groups}.id`).andOn(
|
||||||
`${TableName.UserGroupMembership}.userId`,
|
`${TableName.UserGroupMembership}.userId`,
|
||||||
db.raw("?", [userId])
|
db.raw("?", [userId])
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.leftJoin(TableName.ProjectRoles, `${TableName.Groups}.roleId`, `${TableName.ProjectRoles}.id`)
|
.leftJoin(TableName.OrgRoles, `${TableName.Groups}.roleId`, `${TableName.OrgRoles}.id`)
|
||||||
.select(
|
.select(
|
||||||
db.ref("id").withSchema(TableName.Groups).as("groupId"),
|
db.ref("id").withSchema(TableName.Groups).as("groupId"),
|
||||||
db.ref("orgId").withSchema(TableName.Groups).as("groupOrgId"),
|
db.ref("orgId").withSchema(TableName.Groups).as("groupOrgId"),
|
||||||
@@ -34,7 +34,7 @@ export const permissionDALFactory = (db: TDbClient) => {
|
|||||||
db.ref("roleId").withSchema(TableName.Groups).as("groupRoleId"),
|
db.ref("roleId").withSchema(TableName.Groups).as("groupRoleId"),
|
||||||
db.ref("createdAt").withSchema(TableName.Groups).as("groupCreatedAt"),
|
db.ref("createdAt").withSchema(TableName.Groups).as("groupCreatedAt"),
|
||||||
db.ref("updatedAt").withSchema(TableName.Groups).as("groupUpdatedAt"),
|
db.ref("updatedAt").withSchema(TableName.Groups).as("groupUpdatedAt"),
|
||||||
db.ref("permissions").withSchema(TableName.ProjectRoles).as("groupCustomRolePermission")
|
db.ref("permissions").withSchema(TableName.OrgRoles).as("groupCustomRolePermission")
|
||||||
);
|
);
|
||||||
|
|
||||||
const membership = await db
|
const membership = await db
|
||||||
|
|||||||
Reference in New Issue
Block a user