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 { 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';
|
||||||
|
@ -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
|
||||||
|
@ -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> {
|
||||||
|
Loading…
Reference in New Issue
Block a user