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:
parent
b22b4233cb
commit
7350c91a1e
@ -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';
|
||||
|
@ -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
|
||||
|
@ -185,6 +185,7 @@ class UserController extends Controller {
|
||||
},
|
||||
);
|
||||
} else {
|
||||
res.status(400).end();
|
||||
}
|
||||
}
|
||||
async getMe(req: IAuthRequest, res: Response<MeSchema>): Promise<void> {
|
||||
|
Loading…
Reference in New Issue
Block a user