Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions recodex-web.spec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
%define name recodex-web
%define short_name web-app
%define version 2.17.0
%define unmangled_version c06ba1029a7411a1f7ab431437595344db2fc721
%define release 2
%define unmangled_version aa71037311d5cfb75b8e88882cd24372a6b8638a
%define release 3

Summary: ReCodEx web-app component
Name: %{name}
Expand Down
14 changes: 13 additions & 1 deletion src/components/forms/GenerateTokenForm/GenerateTokenForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ const scopes = [
},
];

const superAdminScopes = [
...scopes,
{
name: (
<FormattedMessage id="app.generateTokenForm.scope.group-external" defaultMessage="External groups management" />
),
key: 'group-external',
},
];

const HOUR_SEC = 3600;
const DAY_SEC = 24 * HOUR_SEC;
const WEEK_SEC = 7 * DAY_SEC;
Expand Down Expand Up @@ -70,6 +80,7 @@ export const initialValues = {
};

const GenerateTokenForm = ({
isSuperAdmin = false,
error,
submitting,
handleSubmit,
Expand Down Expand Up @@ -135,7 +146,7 @@ const GenerateTokenForm = ({
<Field
name="scope"
component={SelectField}
options={scopes}
options={isSuperAdmin ? superAdminScopes : scopes}
label={<FormattedMessage id="app.generateTokenForm.scope" defaultMessage="Scope:" />}
ignoreDirty
/>
Expand Down Expand Up @@ -196,6 +207,7 @@ const GenerateTokenForm = ({
};

GenerateTokenForm.propTypes = {
isSuperAdmin: PropTypes.bool,
error: PropTypes.any,
handleSubmit: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
Expand Down
1 change: 1 addition & 0 deletions src/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@
"app.generateTokenForm.lastToken": "Poslední token:",
"app.generateTokenForm.month": "1 Měsíc",
"app.generateTokenForm.scope": "Rozsah platnosti:",
"app.generateTokenForm.scope.group-external": "Externí správa skupin",
"app.generateTokenForm.scope.master": "Master (všechny operace, výchozí)",
"app.generateTokenForm.scope.plagiarism": "Detekce podobných řešení",
"app.generateTokenForm.scope.readAll": "Pouze čtení",
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@
"app.generateTokenForm.lastToken": "Last Token:",
"app.generateTokenForm.month": "1 Month",
"app.generateTokenForm.scope": "Scope:",
"app.generateTokenForm.scope.group-external": "External groups management",
"app.generateTokenForm.scope.master": "Master (all operations, default)",
"app.generateTokenForm.scope.plagiarism": "Plagiarism detection",
"app.generateTokenForm.scope.readAll": "Read-only",
Expand Down
7 changes: 6 additions & 1 deletion src/pages/EditUser/EditUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,12 @@ class EditUser extends Component {

<Row>
<Col lg={12}>
<GenerateTokenForm onSubmit={generateToken} initialValues={initialValues} lastToken={lastToken} />
<GenerateTokenForm
onSubmit={generateToken}
initialValues={initialValues}
lastToken={lastToken}
isSuperAdmin={isSuperAdmin}
/>
</Col>
</Row>
</>
Expand Down