user with write permission on namespacesPermissions may also read the namespacePermissions so it is consistent to other permissions

This commit is contained in:
Eduard Heimbuch
2020-09-21 10:39:28 +02:00
parent 39b8fcacde
commit bb4874b8c1
9 changed files with 15 additions and 14 deletions

View File

@@ -617,9 +617,9 @@ export function getDeleteRepoFailure(state: object, namespace: string, name: str
export function getPermissionsLink(state: object, namespaceName: string, repoName?: string) {
if (repoName) {
const repo = getRepository(state, namespaceName, repoName);
return repo && repo._links ? repo._links.permissions.href : undefined;
return repo?._links ? repo._links.permissions.href : undefined;
} else {
const namespace = getNamespace(state, namespaceName);
return namespace && namespace._links ? namespace._links.permissions.href : undefined;
return namespace?._links ? namespace?._links?.permissions?.href : undefined;
}
}

View File

@@ -33,7 +33,7 @@ type Props = WithTranslation & {
class PermissionsNavLink extends React.Component<Props> {
hasPermissionsLink = () => {
return this.props.namespace._links.permissions;
return this.props.namespace?._links?.permissions;
};
render() {
if (!this.hasPermissionsLink()) {