Skip to content

Commit

Permalink
feat: authentication configuration permission (#8987)
Browse files Browse the repository at this point in the history
New permission for SSO config.
  • Loading branch information
Tymek authored Dec 17, 2024
1 parent 138ba35 commit 9b15343
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions frontend/src/component/admin/auth/AuthSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ScimSettings } from './ScimSettings/ScimSettings';
import { PasswordAuth } from './PasswordAuth/PasswordAuth';
import { GoogleAuth } from './GoogleAuth/GoogleAuth';
import { PermissionGuard } from 'component/common/PermissionGuard/PermissionGuard';
import { ADMIN } from '@server/types/permissions';
import { ADMIN, UPDATE_AUTH_CONFIGURATION } from '@server/types/permissions';
import { PremiumFeature } from 'component/common/PremiumFeature/PremiumFeature';
import { useState } from 'react';
import { TabPanel } from 'component/common/TabNav/TabPanel/TabPanel';
Expand Down Expand Up @@ -51,7 +51,7 @@ export const AuthSettings = () => {

return (
<div>
<PermissionGuard permissions={ADMIN}>
<PermissionGuard permissions={[ADMIN, UPDATE_AUTH_CONFIGURATION]}>
<PageContent
withTabs
header={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export const RolePermissionCategories = ({
.filter(
({ label }) =>
granularAdminPermissionsEnabled ||
label !== 'Instance maintenance',
(label !== 'Instance maintenance' &&
label !== 'Authentication'),
)
.map(({ label, type, permissions }) => (
<RolePermissionCategory
Expand Down
5 changes: 5 additions & 0 deletions src/lib/types/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const DELETE_TAG_TYPE = 'DELETE_TAG_TYPE';

export const UPDATE_MAINTENANCE_MODE = 'UPDATE_MAINTENANCE_MODE';
export const UPDATE_INSTANCE_BANNERS = 'UPDATE_INSTANCE_BANNERS';
export const UPDATE_AUTH_CONFIGURATION = 'UPDATE_AUTH_CONFIGURATION';

// Project
export const CREATE_FEATURE = 'CREATE_FEATURE';
Expand Down Expand Up @@ -148,6 +149,10 @@ export const ROOT_PERMISSION_CATEGORIES = [
label: 'Instance maintenance',
permissions: [UPDATE_MAINTENANCE_MODE, UPDATE_INSTANCE_BANNERS],
},
{
label: 'Authentication',
permissions: [UPDATE_AUTH_CONFIGURATION],
},
];

// Used on Frontend, to allow admin panel use for users with custom root roles
Expand Down

0 comments on commit 9b15343

Please sign in to comment.