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 { ApplicationView } from '../ApplicationView/ApplicationView';
import { ApplicationUpdate } from '../ApplicationUpdate/ApplicationUpdate';
import { ConnectedInstances } from '../ConnectedInstances/ConnectedInstances';
import { Dialogue } from 'component/common/Dialogue/Dialogue';
import { PageContent } from 'component/common/PageContent/PageContent';
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 filteredRoles = userRoles.some(
(userrole) => userrole.name === 'Admin' || userrole.name === 'Owner',
)
? roles
: roles.filter((role) =>
const displayAllRoles =
userRoles.length === 0 ||
userRoles.some(
(userRole) =>
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),
);
}
return (
<SidebarModal
open

View File

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