mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-24 17:51:14 +02:00
* fix: group project access inconsistencies * fix relative path * wip * refactor: make project tabs work as routes * refactor: finish refactoring project assign forms * fix: update snaps * fix: update snaps * add some basic cypress e2e tests to groups * add remaining cypress e2e tests for group CRUD * add groups e2e to gh workflows * refactor: simplify useMemo usage * add GO_BACK navigate const * fix: remove trailing slash on user creation request Co-authored-by: olav <mail@olav.io> Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
33 lines
978 B
TypeScript
33 lines
978 B
TypeScript
import { ProjectAccessAssign } from '../ProjectAccessAssign/ProjectAccessAssign';
|
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
|
import useProjectAccess, {
|
|
ENTITY_TYPE,
|
|
} from 'hooks/api/getters/useProjectAccess/useProjectAccess';
|
|
import { useAccess } from 'hooks/api/getters/useAccess/useAccess';
|
|
|
|
export const ProjectAccessEditUser = () => {
|
|
const projectId = useRequiredPathParam('projectId');
|
|
const userId = useRequiredPathParam('userId');
|
|
|
|
const { access } = useProjectAccess(projectId);
|
|
const { users, groups } = useAccess();
|
|
|
|
if (!access || !users || !groups) {
|
|
return null;
|
|
}
|
|
|
|
const user = access.rows.find(
|
|
row => row.entity.id === Number(userId) && row.type === ENTITY_TYPE.USER
|
|
);
|
|
|
|
return (
|
|
<ProjectAccessAssign
|
|
accesses={access.rows}
|
|
selected={user}
|
|
users={users}
|
|
groups={groups}
|
|
roles={access.roles}
|
|
/>
|
|
);
|
|
};
|