From a481170445975dbc964d38d99d65012856c32d68 Mon Sep 17 00:00:00 2001 From: srichman333 Date: Mon, 19 Jun 2023 17:25:14 -0400 Subject: groups in Properties View --- src/client/views/PropertiesView.tsx | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/client/views/PropertiesView.tsx') diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx index c7db657ff..ab3864849 100644 --- a/src/client/views/PropertiesView.tsx +++ b/src/client/views/PropertiesView.tsx @@ -412,13 +412,6 @@ export class PropertiesView extends React.Component { return u1 > u2 ? -1 : u1 === u2 ? 0 : 1; }; - /** - * Sorting algorithm to sort groups. - */ - sortGroups = (g1: Doc, g2: Doc) => { - return g1 > g2 ? -1 : g1 === g2 ? 0 : 1; - }; - /** * @returns the sharing and permissions panel. */ @@ -429,7 +422,7 @@ export class PropertiesView extends React.Component { const target = docs[0]; const showAdmin = GetEffectiveAcl(this.selectedDoc!) == AclAdmin - const tableEntries = []; + const individualTableEntries = []; const usersAdded: string[] = []; // all shared users being added - organized by denormalized email // adds each user to usersAdded @@ -449,32 +442,33 @@ export class PropertiesView extends React.Component { usersAdded.sort(this.sortUsers); usersAdded.map(userEmail => { const permission = StrCast(target[`acl-${normalizeEmail(userEmail)}`]); - tableEntries.unshift(this.sharingItem(userEmail, showAdmin, permission, false)); // adds each user + individualTableEntries.unshift(this.sharingItem(userEmail, showAdmin, permission, false)); // adds each user }); // adds current user var userEmail = Doc.CurrentUserEmail; if (userEmail == 'guest') userEmail = 'Public'; if (!usersAdded.includes(userEmail) && userEmail != 'Public' && userEmail != target.author) { - tableEntries.unshift(this.sharingItem(userEmail, showAdmin, StrCast(target[`acl-${normalizeEmail(userEmail)}`]), false)); // adds each user + individualTableEntries.unshift(this.sharingItem(userEmail, showAdmin, StrCast(target[`acl-${normalizeEmail(userEmail)}`]), false)); // adds each user usersAdded.push(userEmail); } + // shift owner to top + individualTableEntries.unshift(this.sharingItem(StrCast(target.author), showAdmin, 'Owner'), false); + // adds groups + const groupTableEntries: JSX.Element[] = []; const groupList = GroupManager.Instance?.allGroups || []; groupList.map(group => { if (group.title != 'Public' && this.selectedDoc) { const groupKey = 'acl-' + normalizeEmail(StrCast(group.title)); if (this.selectedDoc[groupKey] != '' && this.selectedDoc[groupKey] != undefined) { const permission = StrCast(target[groupKey]); - tableEntries.unshift(this.sharingItem(StrCast(group.title), showAdmin, permission, false)); + groupTableEntries.unshift(this.sharingItem(StrCast(group.title), showAdmin, permission, false)); } } }); - // shift owner to top - tableEntries.unshift(this.sharingItem(StrCast(target.author), showAdmin, 'Owner'), false); - return (
{' '} @@ -484,7 +478,16 @@ export class PropertiesView extends React.Component { {' '}

Individual Users with Access to this Document{' '}
-
{
{tableEntries}
}
+
{
{individualTableEntries}
}
+ {groupTableEntries.length>0 ? +
+
+ {' '} +

Groups with Access to this Document{' '} +
+
{
{groupTableEntries}
}
+
+ : null} ); } -- cgit v1.2.3-70-g09d2