Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init rbac db schema #19

Merged
merged 22 commits into from
Sep 7, 2024
Merged

init rbac db schema #19

merged 22 commits into from
Sep 7, 2024

Conversation

jsbroks
Copy link
Member

@jsbroks jsbroks commented Sep 6, 2024

No description provided.

workspace,
} from "@ctrlplane/db/schema";

const scopeHierarchy: Array<ScopeType> = ["deployment", "system", "workspace"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How exactly is the Hierarchy defined?

is it left to right?

.orderBy(sql`ARRAY_POSITION(${scopeHierarchy}, ${entityRole.scopeType})`)

Comment on lines +55 to +61
try {
const system = await create.mutateAsync({ workspaceId, ...values });
await utils.system.list.invalidate();
router.push(`/${workspaceSlug}/systems/${system.slug}`);
} catch (e) {
console.error(e);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will handle this with the slug validation once my other PR looks good.

Comment on lines +95 to +98
<SelectTrigger className="w-[200px]">
<SelectValue placeholder="Select a role" />
</SelectTrigger>
<SelectContent className="w-[200px]">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w-48 | width: 12rem; /* 192px */
w-52 | width: 13rem; /* 208px */


return (
<Select defaultValue={currentRoleId}>
<SelectTrigger className="w-[230px]">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w-56 | width: 14rem; /* 224px */
w-60 | width: 15rem; /* 240px */

Comment on lines 35 to 47
// viewerAllPermissions: protectedProcedure.query(({ ctx }) =>
// ctx.db
// .selectDistinct({ permission: rolePermission.permission })
// .from(rolePermission)
// .innerJoin(role, eq(role.id, rolePermission.roleId))
// .innerJoin(entityRole, eq(entityRole.roleId, role.id))
// .innerJoin(
// user,
// and(eq(user.id, entityRole.id), eq(entityRole.entityType, "user")),
// )
// .where(eq(user.id, ctx.session.user.id)),
// ),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete?

@zacharyblasczyk
Copy link
Member

Just fix the build and lint.

@jsbroks jsbroks merged commit 2c9cdde into main Sep 7, 2024
10 checks passed
@jsbroks jsbroks deleted the rbac branch September 7, 2024 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants