aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/GroupManager.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-09-23 11:56:54 -0400
committerbobzel <zzzman@gmail.com>2020-09-23 11:56:54 -0400
commitc7d8dd124fcc4d427fe37085317fe63f9005d3f3 (patch)
tree75ec9506dbbc26e3491220259a83a0f9902bc2e0 /src/client/util/GroupManager.tsx
parentb97e7dcb31f4f8812d86b9b1944b912b544f3824 (diff)
parent3432a0696d0d1fe42e00c9cf97a96368442a9faf (diff)
Merge branch 'acls_uv'
Diffstat (limited to 'src/client/util/GroupManager.tsx')
-rw-r--r--src/client/util/GroupManager.tsx17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/client/util/GroupManager.tsx b/src/client/util/GroupManager.tsx
index cb15b5081..cb512bca8 100644
--- a/src/client/util/GroupManager.tsx
+++ b/src/client/util/GroupManager.tsx
@@ -278,21 +278,24 @@ export class GroupManager extends React.Component<{}> {
*/
@action
createGroup = () => {
- if (!this.inputRef.current?.value) {
+ const { value } = this.inputRef.current!;
+ if (!value) {
alert("Please enter a group name");
return;
}
- if (this.inputRef.current.value.toLowerCase() === "admin" && this.getGroup("Admin")) {
- alert("You cannot override the Admin group");
- return;
+ if (["admin", "public", "override"].includes(value.toLowerCase())) {
+ if (value.toLowerCase() !== "admin" || (value.toLowerCase() === "admin" && this.getGroup("Admin"))) {
+ alert(`You cannot override the ${value.charAt(0).toUpperCase() + value.slice(1)} group`);
+ return;
+ }
}
- if (this.getGroup(this.inputRef.current.value)) {
+ if (this.getGroup(value)) {
alert("Please select a unique group name");
return;
}
- this.createGroupDoc(this.inputRef.current.value, this.selectedUsers?.map(user => user.value));
+ this.createGroupDoc(value, this.selectedUsers?.map(user => user.value));
this.selectedUsers = null;
- this.inputRef.current.value = "";
+ this.inputRef.current!.value = "";
this.buttonColour = "#979797";
const { left, width, top } = this.createGroupButtonRef.current!.getBoundingClientRect();