Skip to content

Commit

Permalink
restore acl ui in sharing tab
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Jan 9, 2024
1 parent 2fb1bae commit a101569
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
71 changes: 35 additions & 36 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,53 +137,52 @@ const parseAclList = (acls) => {
return list
}

/** @type OC.Plugin */
const FilesPlugin = {
attach(fileList) {
client = fileList.filesClient
client.addFileInfoParser((response) => {
const data = {}
const props = response.propStat[0].properties
const groupFolderId = props[ACL_PROPERTIES.GROUP_FOLDER_ID]
if (typeof groupFolderId !== 'undefined') {
data.groupFolderId = groupFolderId
}
const aclEnabled = props[ACL_PROPERTIES.PROPERTY_ACL_ENABLED]
if (typeof aclEnabled !== 'undefined') {
data.aclEnabled = !!aclEnabled
}
export function initFilesClient(filesClient) {

Check warning on line 140 in src/client.js

View workflow job for this annotation

GitHub Actions / NPM lint

Missing JSDoc comment
client = filesClient;

Check failure on line 141 in src/client.js

View workflow job for this annotation

GitHub Actions / NPM lint

Extra semicolon
patchFilesClient(filesClient);

Check failure on line 142 in src/client.js

View workflow job for this annotation

GitHub Actions / NPM lint

Extra semicolon
}

const aclCanManage = props[ACL_PROPERTIES.PROPERTY_ACL_CAN_MANAGE]
if (typeof aclCanManage !== 'undefined') {
data.aclCanManage = !!aclCanManage
}
function patchFilesClient(client) {

Check warning on line 145 in src/client.js

View workflow job for this annotation

GitHub Actions / NPM lint

Missing JSDoc comment
client.addFileInfoParser((response) => {
const data = {}
const props = response.propStat[0].properties
const groupFolderId = props[ACL_PROPERTIES.GROUP_FOLDER_ID]
if (typeof groupFolderId !== 'undefined') {
data.groupFolderId = groupFolderId
}
const aclEnabled = props[ACL_PROPERTIES.PROPERTY_ACL_ENABLED]
if (typeof aclEnabled !== 'undefined') {
data.aclEnabled = !!aclEnabled
}

const acls = props[ACL_PROPERTIES.PROPERTY_ACL_LIST] || []
const inheritedAcls = props[ACL_PROPERTIES.PROPERTY_INHERITED_ACL_LIST] || []
const aclCanManage = props[ACL_PROPERTIES.PROPERTY_ACL_CAN_MANAGE]
if (typeof aclCanManage !== 'undefined') {
data.aclCanManage = !!aclCanManage
}

data.acl = parseAclList(acls)
data.inheritedAcls = parseAclList(inheritedAcls)
const acls = props[ACL_PROPERTIES.PROPERTY_ACL_LIST] || []
const inheritedAcls = props[ACL_PROPERTIES.PROPERTY_INHERITED_ACL_LIST] || []

data.acl.map((acl) => {
const inheritedAcl = data.inheritedAcls.find((inheritedAclRule) => inheritedAclRule.mappingType === acl.mappingType && inheritedAclRule.mappingId === acl.mappingId)
if (inheritedAcl) {
acl.permissions = (acl.permissions & acl.mask) | (inheritedAcl.permissions & ~acl.mask)
}
return acl
})
return data
data.acl = parseAclList(acls)
data.inheritedAcls = parseAclList(inheritedAcls)

data.acl.map((acl) => {
const inheritedAcl = data.inheritedAcls.find((inheritedAclRule) => inheritedAclRule.mappingType === acl.mappingType && inheritedAclRule.mappingId === acl.mappingId)
if (inheritedAcl) {
acl.permissions = (acl.permissions & acl.mask) | (inheritedAcl.permissions & ~acl.mask)
}
return acl
})
return data
})

patchClientForNestedPropPatch(client)
},
};
patchClientForNestedPropPatch(client)
}

(function(OC) {
Object.assign(OC.Files.Client, ACL_PROPERTIES)
})(window.OC)

OC.Plugins.register('OCA.Files.FileList', FilesPlugin)

class AclDavService {

propFind(model) {
Expand Down
2 changes: 2 additions & 0 deletions src/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
import { generateUrl, imagePath } from '@nextcloud/router'
import './client.js'

Check failure on line 23 in src/files.js

View workflow job for this annotation

GitHub Actions / NPM lint

'/home/runner/work/groupfolders/groupfolders/src/client.js' imported multiple times
import {initFilesClient} from "./client";

Check failure on line 24 in src/files.js

View workflow job for this annotation

GitHub Actions / NPM lint

A space is required after '{'

Check failure on line 24 in src/files.js

View workflow job for this annotation

GitHub Actions / NPM lint

A space is required before '}'

Check warning on line 24 in src/files.js

View workflow job for this annotation

GitHub Actions / NPM lint

Missing file extension "js" for "./client"

Check failure on line 24 in src/files.js

View workflow job for this annotation

GitHub Actions / NPM lint

Strings must use singlequote

Check failure on line 24 in src/files.js

View workflow job for this annotation

GitHub Actions / NPM lint

'/home/runner/work/groupfolders/groupfolders/src/client.js' imported multiple times

Check failure on line 24 in src/files.js

View workflow job for this annotation

GitHub Actions / NPM lint

"./client" is not found

Check failure on line 24 in src/files.js

View workflow job for this annotation

GitHub Actions / NPM lint

Extra semicolon

// eslint-disable-next-line
__webpack_nonce__ = btoa(OC.requestToken)
Expand All @@ -38,6 +39,7 @@ window.addEventListener('DOMContentLoaded', () => {
return
}
import(/* webpackChunkName: "sharing" */'./SharingSidebarApp.js').then((Module) => {
initFilesClient(OC.Files.getClient());

Check failure on line 42 in src/files.js

View workflow job for this annotation

GitHub Actions / NPM lint

Extra semicolon
OCA.Sharing.ShareTabSections.registerSection((el, fileInfo) => {
if (fileInfo.mountType !== 'group') {
return
Expand Down

0 comments on commit a101569

Please sign in to comment.