1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: display all roles if we can't get project roles

This commit is contained in:
Christopher Kolstad 2024-02-20 16:16:42 +01:00
parent b22b4233cb
commit 7350c91a1e
No known key found for this signature in database
GPG Key ID: D9041DC670F032F3
3 changed files with 15 additions and 8 deletions

View File

@ -16,7 +16,6 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
import { UPDATE_APPLICATION } from 'component/providers/AccessProvider/permissions'; import { UPDATE_APPLICATION } from 'component/providers/AccessProvider/permissions';
import { ApplicationView } from '../ApplicationView/ApplicationView'; import { ApplicationView } from '../ApplicationView/ApplicationView';
import { ApplicationUpdate } from '../ApplicationUpdate/ApplicationUpdate'; import { ApplicationUpdate } from '../ApplicationUpdate/ApplicationUpdate';
import { ConnectedInstances } from '../ConnectedInstances/ConnectedInstances';
import { Dialogue } from 'component/common/Dialogue/Dialogue'; import { Dialogue } from 'component/common/Dialogue/Dialogue';
import { PageContent } from 'component/common/PageContent/PageContent'; import { PageContent } from 'component/common/PageContent/PageContent';
import { PageHeader } from 'component/common/PageHeader/PageHeader'; import { PageHeader } from 'component/common/PageHeader/PageHeader';

View File

@ -321,13 +321,20 @@ export const ProjectAccessAssign = ({
}; };
const isValid = selectedOptions.length > 0 && selectedRoles.length > 0; const isValid = selectedOptions.length > 0 && selectedRoles.length > 0;
const filteredRoles = userRoles.some( const displayAllRoles =
(userrole) => userrole.name === 'Admin' || userrole.name === 'Owner', userRoles.length === 0 ||
) userRoles.some(
? roles (userRole) =>
: roles.filter((role) => userRole.name === 'Admin' || userRole.name === 'Owner',
);
let filteredRoles: IRole[];
if (displayAllRoles) {
filteredRoles = roles;
} else {
filteredRoles = roles.filter((role) =>
userRoles.some((userrole) => role.id === userrole.id), userRoles.some((userrole) => role.id === userrole.id),
); );
}
return ( return (
<SidebarModal <SidebarModal
open open

View File

@ -185,6 +185,7 @@ class UserController extends Controller {
}, },
); );
} else { } else {
res.status(400).end();
} }
} }
async getMe(req: IAuthRequest, res: Response<MeSchema>): Promise<void> { async getMe(req: IAuthRequest, res: Response<MeSchema>): Promise<void> {