forked from baron/baron-sso
백업/복구로직 변경, 깜빡임 버그 해결
This commit is contained in:
@@ -49,7 +49,11 @@ import {
|
||||
type UserCreateResponse,
|
||||
} from "../../lib/adminApi";
|
||||
import { t } from "../../lib/i18n";
|
||||
import { isSuperAdminRole, normalizeAdminRole } from "../../lib/roles";
|
||||
import {
|
||||
canManageTenantScopedUsers,
|
||||
isSuperAdminRole,
|
||||
normalizeAdminRole,
|
||||
} from "../../lib/roles";
|
||||
import {
|
||||
buildAuthenticatedOrgChartTenantPickerUrl,
|
||||
filterNonHanmacFamilyTenants,
|
||||
@@ -154,6 +158,7 @@ function UserCreatePage() {
|
||||
queryFn: fetchMe,
|
||||
});
|
||||
const profileRole = normalizeAdminRole(profile?.role);
|
||||
const canManageUsers = canManageTenantScopedUsers(profile);
|
||||
|
||||
const {
|
||||
register,
|
||||
@@ -204,8 +209,12 @@ function UserCreatePage() {
|
||||
|
||||
// Lock company for non-super_admin
|
||||
React.useEffect(() => {
|
||||
if (profileRole !== "super_admin" && profile?.tenantSlug) {
|
||||
setValue("tenantSlug", profile.tenantSlug);
|
||||
if (profileRole !== "super_admin") {
|
||||
const delegatedTenantSlug =
|
||||
profile?.tenantSlug || profile?.manageableTenants?.[0]?.slug;
|
||||
if (delegatedTenantSlug) {
|
||||
setValue("tenantSlug", delegatedTenantSlug);
|
||||
}
|
||||
}
|
||||
}, [profile, profileRole, setValue]);
|
||||
|
||||
@@ -524,8 +533,7 @@ function UserCreatePage() {
|
||||
}
|
||||
};
|
||||
|
||||
// Access Control: Only super_admin can create users
|
||||
if (profile && profileRole !== "super_admin") {
|
||||
if (profile && !canManageUsers) {
|
||||
return (
|
||||
<div className="flex h-[50vh] flex-col items-center justify-center space-y-4">
|
||||
<ShieldAlert size={48} className="text-destructive" />
|
||||
|
||||
Reference in New Issue
Block a user