forked from baron/baron-sso
feat(adminfront): implement user role management and cleanup tenant list UI
- Add user role management (view, edit, bulk) in UserListPage, UserDetailPage, and UserCreatePage. - Restrict role modification to super_admin only. - Remove redundant action columns from tenant-related lists (TenantListPage, TenantSubTenantsPage, TenantUsersPage, TenantAdminsAndOwnersTab). - Improve navigation by making table rows clickable where actions were removed.
This commit is contained in:
@@ -318,6 +318,11 @@ function UserListPage() {
|
||||
bulkUpdateMutation.mutate({ userIds: selectedUserIds, status });
|
||||
};
|
||||
|
||||
const handleBulkRoleChange = (role: string) => {
|
||||
if (selectedUserIds.length === 0) return;
|
||||
bulkUpdateMutation.mutate({ userIds: selectedUserIds, role });
|
||||
};
|
||||
|
||||
const handleBulkDelete = () => {
|
||||
if (selectedUserIds.length === 0) return;
|
||||
if (
|
||||
@@ -567,6 +572,15 @@ function UserListPage() {
|
||||
{getSortIcon("status")}
|
||||
</div>
|
||||
</TableHead>
|
||||
<TableHead
|
||||
className="whitespace-nowrap cursor-pointer hover:bg-muted/50 transition-colors"
|
||||
onClick={() => requestSort("role")}
|
||||
>
|
||||
<div className="flex items-center">
|
||||
{t("ui.admin.users.list.table.role", "ROLE")}
|
||||
{getSortIcon("role")}
|
||||
</div>
|
||||
</TableHead>
|
||||
<TableHead
|
||||
className="whitespace-nowrap cursor-pointer hover:bg-muted/50 transition-colors"
|
||||
onClick={() => requestSort("tenant_dept")}
|
||||
@@ -711,6 +725,48 @@ function UserListPage() {
|
||||
</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Select
|
||||
defaultValue={user.role}
|
||||
onValueChange={(value) =>
|
||||
bulkUpdateMutation.mutate({
|
||||
userIds: [user.id],
|
||||
role: value,
|
||||
})
|
||||
}
|
||||
disabled={
|
||||
bulkUpdateMutation.isPending ||
|
||||
profile?.role !== "super_admin" ||
|
||||
user.id === profile?.id
|
||||
}
|
||||
>
|
||||
<SelectTrigger className="h-8 w-[140px] border-none bg-transparent hover:bg-muted/50 transition-colors px-0 font-medium">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{profile?.role === "super_admin" && (
|
||||
<SelectItem value="super_admin">
|
||||
{t(
|
||||
"ui.admin.role.super_admin",
|
||||
"시스템 관리자",
|
||||
)}
|
||||
</SelectItem>
|
||||
)}
|
||||
<SelectItem value="tenant_admin">
|
||||
{t(
|
||||
"ui.admin.role.tenant_admin",
|
||||
"테넌트 관리자",
|
||||
)}
|
||||
</SelectItem>
|
||||
<SelectItem value="rp_admin">
|
||||
{t("ui.admin.role.rp_admin", "서비스 관리자")}
|
||||
</SelectItem>
|
||||
<SelectItem value="user">
|
||||
{t("ui.admin.role.user", "일반 사용자")}
|
||||
</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="flex flex-col gap-1">
|
||||
<span className="text-sm font-medium">
|
||||
@@ -775,6 +831,34 @@ function UserListPage() {
|
||||
{t("ui.common.status.inactive", "비활성화")}
|
||||
</Button>
|
||||
<div className="w-px h-4 bg-background/20 mx-1" />
|
||||
{profile?.role === "super_admin" && (
|
||||
<>
|
||||
<Select onValueChange={handleBulkRoleChange}>
|
||||
<SelectTrigger className="h-8 w-[140px] bg-transparent border-background/20 text-background text-xs">
|
||||
<SelectValue
|
||||
placeholder={
|
||||
t("ui.admin.users.list.table.role", "ROLE")
|
||||
}
|
||||
/>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="super_admin">
|
||||
{t("ui.admin.role.super_admin", "시스템 관리자")}
|
||||
</SelectItem>
|
||||
<SelectItem value="tenant_admin">
|
||||
{t("ui.admin.role.tenant_admin", "테넌트 관리자")}
|
||||
</SelectItem>
|
||||
<SelectItem value="rp_admin">
|
||||
{t("ui.admin.role.rp_admin", "서비스 관리자")}
|
||||
</SelectItem>
|
||||
<SelectItem value="user">
|
||||
{t("ui.admin.role.user", "일반 사용자")}
|
||||
</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div className="w-px h-4 bg-background/20 mx-1" />
|
||||
</>
|
||||
)}
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
|
||||
Reference in New Issue
Block a user