From 204c978c09ef749c02e43604966d861c79b6f5ed Mon Sep 17 00:00:00 2001
From: usodhi <61431818+usodhi@users.noreply.github.com>
Date: Sun, 30 Aug 2020 14:42:51 +0530
Subject: changes for multiple docs selected + other small changes

---
 src/client/util/GroupManager.tsx | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'src/client/util/GroupManager.tsx')

diff --git a/src/client/util/GroupManager.tsx b/src/client/util/GroupManager.tsx
index 314640012..af7ad1cdf 100644
--- a/src/client/util/GroupManager.tsx
+++ b/src/client/util/GroupManager.tsx
@@ -87,6 +87,7 @@ export class GroupManager extends React.Component<{}> {
                 const members: string[] = JSON.parse(StrCast(group.members));
                 if (members.includes(Doc.CurrentUserEmail)) this.currentUserGroups.push(StrCast(group.groupName));
             });
+            this.currentUserGroups.push("Public");
             setGroups(this.currentUserGroups);
         });
     }
@@ -116,6 +117,7 @@ export class GroupManager extends React.Component<{}> {
     close = () => {
         this.isOpen = false;
         this.currentGroup = undefined;
+        this.selectedUsers = null;
         // this.users = [];
         this.createGroupModalOpen = false;
         TaskCompletionBox.taskCompleted = false;
-- 
cgit v1.2.3-70-g09d2


From 22889f0c39e4ffe2659b84befdc5028ade034b6f Mon Sep 17 00:00:00 2001
From: usodhi <61431818+usodhi@users.noreply.github.com>
Date: Sun, 30 Aug 2020 20:51:56 +0530
Subject: admin case

---
 src/client/util/GroupManager.tsx | 4 ++--
 src/fields/util.ts               | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/client/util/GroupManager.tsx')

diff --git a/src/client/util/GroupManager.tsx b/src/client/util/GroupManager.tsx
index af7ad1cdf..0765d89e4 100644
--- a/src/client/util/GroupManager.tsx
+++ b/src/client/util/GroupManager.tsx
@@ -159,7 +159,7 @@ export class GroupManager extends React.Component<{}> {
      * @returns the members of the admin group.
      */
     get adminGroupMembers(): string[] {
-        return this.getGroup("admin") ? JSON.parse(StrCast(this.getGroup("admin")!.members)) : "";
+        return this.getGroup("Admin") ? JSON.parse(StrCast(this.getGroup("Admin")!.members)) : "";
     }
 
     /**
@@ -179,7 +179,7 @@ export class GroupManager extends React.Component<{}> {
      */
     createGroupDoc(groupName: string, memberEmails: string[] = []) {
         const groupDoc = new Doc;
-        groupDoc.groupName = groupName;
+        groupDoc.groupName = groupName.toLowerCase() === "admin" ? "Admin" : groupName;
         groupDoc.owners = JSON.stringify([Doc.CurrentUserEmail]);
         groupDoc.members = JSON.stringify(memberEmails);
         if (memberEmails.includes(Doc.CurrentUserEmail)) {
diff --git a/src/fields/util.ts b/src/fields/util.ts
index 069f01195..d0c722ddc 100644
--- a/src/fields/util.ts
+++ b/src/fields/util.ts
@@ -166,7 +166,7 @@ export function GetEffectiveAcl(target: any, in_prop?: string | symbol | number,
 
     if (target[AclSym] && Object.keys(target[AclSym]).length) {
 
-        if (currentUserGroups.includes("admin")) return AclAdmin;
+        if (currentUserGroups.includes("Admin")) return AclAdmin;
 
         // if the ACL is being overriden or the property being modified is one of the playground fields (which can be freely modified)
         if (_overrideAcl || (in_prop && DocServer.PlaygroundFields?.includes(in_prop.toString()))) return AclEdit;
-- 
cgit v1.2.3-70-g09d2


From 0bdcfdb9b8e0fdfe48b58f1d2645325011d668d5 Mon Sep 17 00:00:00 2001
From: usodhi <61431818+usodhi@users.noreply.github.com>
Date: Sun, 30 Aug 2020 21:20:24 +0530
Subject: admin alert

---
 src/client/util/GroupManager.tsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'src/client/util/GroupManager.tsx')

diff --git a/src/client/util/GroupManager.tsx b/src/client/util/GroupManager.tsx
index 0765d89e4..cb15b5081 100644
--- a/src/client/util/GroupManager.tsx
+++ b/src/client/util/GroupManager.tsx
@@ -282,7 +282,11 @@ export class GroupManager extends React.Component<{}> {
             alert("Please enter a group name");
             return;
         }
-        if (this.getAllGroups().find(group => group.groupName === this.inputRef.current!.value)) { // why do I need a null check here?
+        if (this.inputRef.current.value.toLowerCase() === "admin" && this.getGroup("Admin")) {
+            alert("You cannot override the Admin group");
+            return;
+        }
+        if (this.getGroup(this.inputRef.current.value)) {
             alert("Please select a unique group name");
             return;
         }
-- 
cgit v1.2.3-70-g09d2

