mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-11 23:04:59 +00:00
🚧 wip
This commit is contained in:
@@ -700,6 +700,14 @@ authenticated.get(
|
|||||||
resource.listResourcePolicyRoles
|
resource.listResourcePolicyRoles
|
||||||
);
|
);
|
||||||
|
|
||||||
|
authenticated.put(
|
||||||
|
"/resource-policy/:resourcePolicyId/access-control",
|
||||||
|
verifyResourcePolicyAccess,
|
||||||
|
verifyUserHasAction(ActionsEnum.setResourcePolicyUsers),
|
||||||
|
verifyUserHasAction(ActionsEnum.setResourcePolicyRoles),
|
||||||
|
policy.setResourcePolicyAccessControl
|
||||||
|
);
|
||||||
|
|
||||||
authenticated.get(
|
authenticated.get(
|
||||||
"/resource-policy/:resourcePolicyId/users",
|
"/resource-policy/:resourcePolicyId/users",
|
||||||
verifyResourcePolicyAccess,
|
verifyResourcePolicyAccess,
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ import {
|
|||||||
verifyApiKeySetResourceClients,
|
verifyApiKeySetResourceClients,
|
||||||
verifyLimits,
|
verifyLimits,
|
||||||
verifyApiKeyDomainAccess,
|
verifyApiKeyDomainAccess,
|
||||||
verifyApiKeyResourcePolicyAccess
|
verifyApiKeyResourcePolicyAccess,
|
||||||
|
verifyUserHasAction
|
||||||
} from "@server/middlewares";
|
} from "@server/middlewares";
|
||||||
import HttpCode from "@server/types/HttpCode";
|
import HttpCode from "@server/types/HttpCode";
|
||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
@@ -619,6 +620,18 @@ authenticated.post(
|
|||||||
resource.setResourceUsers
|
resource.setResourceUsers
|
||||||
);
|
);
|
||||||
|
|
||||||
|
authenticated.put(
|
||||||
|
"/resource-policy/:resourcePolicyId/access-control",
|
||||||
|
verifyApiKeyResourcePolicyAccess,
|
||||||
|
verifyApiKeyRoleAccess,
|
||||||
|
verifyLimits,
|
||||||
|
verifyUserHasAction(ActionsEnum.setResourcePolicyUsers),
|
||||||
|
verifyUserHasAction(ActionsEnum.setResourcePolicyRoles),
|
||||||
|
logActionAudit(ActionsEnum.setResourcePolicyUsers),
|
||||||
|
logActionAudit(ActionsEnum.setResourcePolicyRoles),
|
||||||
|
policy.setResourcePolicyAccessControl
|
||||||
|
);
|
||||||
|
|
||||||
authenticated.post(
|
authenticated.post(
|
||||||
"/resource/:resourceId/roles/add",
|
"/resource/:resourceId/roles/add",
|
||||||
verifyApiKeyResourceAccess,
|
verifyApiKeyResourceAccess,
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
export * from "./getResourcePolicy";
|
export * from "./getResourcePolicy";
|
||||||
export * from "./updateResourcePolicy";
|
export * from "./updateResourcePolicy";
|
||||||
|
export * from "./setResourcePolicyAccessControl";
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ registry.registerPath({
|
|||||||
responses: {}
|
responses: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function setResourceUsers(
|
export async function setResourcePolicyAccessControl(
|
||||||
req: Request,
|
req: Request,
|
||||||
res: Response,
|
res: Response,
|
||||||
next: NextFunction
|
next: NextFunction
|
||||||
|
|||||||
@@ -275,12 +275,11 @@ export function EditPolicyForm({ hidePolicyNameForm }: EditPolicyFormProps) {
|
|||||||
<SettingsContainer>
|
<SettingsContainer>
|
||||||
{/* Name */}
|
{/* Name */}
|
||||||
{!hidePolicyNameForm && <PolicyNameSection />}
|
{!hidePolicyNameForm && <PolicyNameSection />}
|
||||||
{/* <PolicyUsersRolesSection
|
<PolicyUsersRolesSection
|
||||||
|
allRoles={allRoles}
|
||||||
allRoles={allRoles}
|
allUsers={allUsers}
|
||||||
allUsers={allUsers}
|
allIdps={allIdps}
|
||||||
allIdps={allIdps}
|
/>
|
||||||
/> */}
|
|
||||||
{/*
|
{/*
|
||||||
<PolicyAuthMethodsSection form={form} />
|
<PolicyAuthMethodsSection form={form} />
|
||||||
<PolicyOtpEmailSection
|
<PolicyOtpEmailSection
|
||||||
@@ -413,19 +412,35 @@ export function PolicyNameSection() {
|
|||||||
// ─── PolicyUsersRolesSection ──────────────────────────────────────────────────
|
// ─── PolicyUsersRolesSection ──────────────────────────────────────────────────
|
||||||
|
|
||||||
type PolicyUsersRolesSectionProps = {
|
type PolicyUsersRolesSectionProps = {
|
||||||
form: UseFormReturn<PolicyFormValues, any, any>;
|
|
||||||
allRoles: { id: string; text: string }[];
|
allRoles: { id: string; text: string }[];
|
||||||
allUsers: { id: string; text: string }[];
|
allUsers: { id: string; text: string }[];
|
||||||
allIdps: { id: number; text: string }[];
|
allIdps: { id: number; text: string }[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export function PolicyUsersRolesSection({
|
export function PolicyUsersRolesSection({
|
||||||
form,
|
|
||||||
allRoles,
|
allRoles,
|
||||||
allUsers,
|
allUsers,
|
||||||
allIdps
|
allIdps
|
||||||
}: PolicyUsersRolesSectionProps) {
|
}: PolicyUsersRolesSectionProps) {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
|
|
||||||
|
const { policy } = useResourcePolicyContext();
|
||||||
|
|
||||||
|
const form = useForm({
|
||||||
|
resolver: zodResolver(
|
||||||
|
createPolicySchema.pick({
|
||||||
|
sso: true,
|
||||||
|
skipToIdpId: true,
|
||||||
|
users: true,
|
||||||
|
roles: true
|
||||||
|
})
|
||||||
|
),
|
||||||
|
defaultValues: {
|
||||||
|
sso: policy.sso,
|
||||||
|
skipToIdpId: policy.idpId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const ssoEnabled = useWatch({ control: form.control, name: "sso" });
|
const ssoEnabled = useWatch({ control: form.control, name: "sso" });
|
||||||
const selectedIdpId = useWatch({
|
const selectedIdpId = useWatch({
|
||||||
control: form.control,
|
control: form.control,
|
||||||
|
|||||||
Reference in New Issue
Block a user