mirror of
https://github.com/freedbygrace/DynamoDNS.git
synced 2026-08-20 14:42:16 +00:00
Implement custom role-based access control. Adds support for creating and managing custom roles, groups, and group memberships.
Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/c73adeb7-0636-4b42-81ad-b861016d2129.jpg
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useState } from "react";
|
||||
import { useQuery, useMutation } from "@tanstack/react-query";
|
||||
import { MainLayout } from "@/components/layouts/main-layout";
|
||||
import { ApiToken, InsertApiToken, userRoles } from "@shared/schema";
|
||||
import { ApiToken, InsertApiToken, systemRoles } from "@shared/schema";
|
||||
import { useAuth } from "@/hooks/use-auth";
|
||||
import { useOrganization } from "@/context/organization-context";
|
||||
import { apiRequest, queryClient } from "@/lib/queryClient";
|
||||
@@ -337,7 +337,7 @@ export default function ApiTokensPage() {
|
||||
Select the permissions for this token
|
||||
</FormDescription>
|
||||
</div>
|
||||
{userRoles.map((role) => (
|
||||
{systemRoles.map((role) => (
|
||||
<FormField
|
||||
key={role}
|
||||
control={form.control}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState } from "react";
|
||||
import { useQuery, useMutation } from "@tanstack/react-query";
|
||||
import { MainLayout } from "@/components/layouts/main-layout";
|
||||
import { User, InsertUser, userRoles, UserRole } from "@shared/schema";
|
||||
import { User, InsertUser, systemRoles, UserRole } from "@shared/schema";
|
||||
import { useAuth } from "@/hooks/use-auth";
|
||||
import { apiRequest, queryClient } from "@/lib/queryClient";
|
||||
import { useToast } from "@/hooks/use-toast";
|
||||
@@ -76,7 +76,7 @@ const userFormSchema = z.object({
|
||||
email: z.string().email("Please enter a valid email"),
|
||||
password: z.string().min(8, "Password must be at least 8 characters"),
|
||||
fullName: z.string().optional(),
|
||||
role: z.enum(userRoles as [string, ...string[]]),
|
||||
role: z.enum(systemRoles as [string, ...string[]]),
|
||||
organizationId: z.number().optional(),
|
||||
});
|
||||
|
||||
@@ -119,7 +119,7 @@ export default function UsersRolesPage() {
|
||||
// Form for editing a user's role
|
||||
const editRoleForm = useForm<{ role: UserRole }>({
|
||||
resolver: zodResolver(z.object({
|
||||
role: z.enum(userRoles as [string, ...string[]]),
|
||||
role: z.enum(systemRoles as [string, ...string[]]),
|
||||
})),
|
||||
defaultValues: {
|
||||
role: "user",
|
||||
@@ -551,7 +551,7 @@ export default function UsersRolesPage() {
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{userRoles.map(role => (
|
||||
{systemRoles.map(role => (
|
||||
<SelectItem key={role} value={role}>
|
||||
{role.charAt(0).toUpperCase() + role.slice(1)}
|
||||
</SelectItem>
|
||||
@@ -642,7 +642,7 @@ export default function UsersRolesPage() {
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{userRoles.map(role => (
|
||||
{systemRoles.map(role => (
|
||||
<SelectItem key={role} value={role}>
|
||||
{role.charAt(0).toUpperCase() + role.slice(1)}
|
||||
</SelectItem>
|
||||
|
||||
Reference in New Issue
Block a user