mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 22:45:45 +01:00
Translate verbs of permissions
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
// @flow
|
||||||
|
import React from "react";
|
||||||
|
import { translate } from "react-i18next";
|
||||||
|
import { Checkbox } from "@scm-manager/ui-components";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
t: (string) => string,
|
||||||
|
name: string,
|
||||||
|
checked: boolean,
|
||||||
|
onChange?: (value: boolean, name?: string) => void
|
||||||
|
};
|
||||||
|
|
||||||
|
class PermissionCheckbox extends React.Component<Props> {
|
||||||
|
render() {
|
||||||
|
const { t } = this.props;
|
||||||
|
return (<Checkbox
|
||||||
|
key={this.props.name}
|
||||||
|
name={this.props.name}
|
||||||
|
helpText={t("verbs.repository." + this.props.name + ".description")}
|
||||||
|
label={t("verbs.repository." + this.props.name + ".displayName")}
|
||||||
|
checked={this.props.checked}
|
||||||
|
onChange={this.props.onChange}
|
||||||
|
/>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default translate("plugins")(PermissionCheckbox);
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Button, Checkbox, SubmitButton } from "@scm-manager/ui-components";
|
import { Button, SubmitButton } from "@scm-manager/ui-components";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
|
import PermissionCheckbox from "../components/PermissionCheckbox";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
availableVerbs: string[],
|
availableVerbs: string[],
|
||||||
@@ -35,10 +36,8 @@ class AdvancedPermissionsDialog extends React.Component<Props, State> {
|
|||||||
const { verbs } = this.state;
|
const { verbs } = this.state;
|
||||||
|
|
||||||
const verbSelectBoxes = Object.entries(verbs).map(e => (
|
const verbSelectBoxes = Object.entries(verbs).map(e => (
|
||||||
<Checkbox
|
<PermissionCheckbox
|
||||||
key={e[0]}
|
|
||||||
name={e[0]}
|
name={e[0]}
|
||||||
label={e[0]}
|
|
||||||
checked={e[1]}
|
checked={e[1]}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -37,5 +37,45 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"unknown": "Unknown permission"
|
"unknown": "Unknown permission"
|
||||||
|
},
|
||||||
|
"verbs": {
|
||||||
|
"repository": {
|
||||||
|
"read": {
|
||||||
|
"displayName": "read",
|
||||||
|
"description": "May see the repository inside the SCM-Manager"
|
||||||
|
},
|
||||||
|
"modify": {
|
||||||
|
"displayName": "modify",
|
||||||
|
"description": "May modify the properties of the repository"
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"displayName": "delete",
|
||||||
|
"description": "May delete the repository"
|
||||||
|
},
|
||||||
|
"pull": {
|
||||||
|
"displayName": "pull/checkout",
|
||||||
|
"description": "May pull/checkout the repository"
|
||||||
|
},
|
||||||
|
"push": {
|
||||||
|
"displayName": "push/commit",
|
||||||
|
"description": "May change the content of the repository (push/commit)"
|
||||||
|
},
|
||||||
|
"permissionRead": {
|
||||||
|
"displayName": "read permissions",
|
||||||
|
"description": "May see the permissions of the repository"
|
||||||
|
},
|
||||||
|
"permissionWrite": {
|
||||||
|
"displayName": "modify permissions",
|
||||||
|
"description": "May modify the permissions of the repository"
|
||||||
|
},
|
||||||
|
"healthCheck": {
|
||||||
|
"displayName": "health check",
|
||||||
|
"description": "May run the health check for the repository"
|
||||||
|
},
|
||||||
|
"*": {
|
||||||
|
"displayName": "overall",
|
||||||
|
"description": "May change everything for the repository (includes all other permissions)"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user