UNPKG

@documentica/webdav

Version:
34 lines (33 loc) 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const createWebdavRequest_1 = require("../createWebdavRequest"); //invert not supported function acl({ config, path, aces, success, fail, headers }) { createWebdavRequest_1.createWebdavRequest({ config, method: 'ACL', path, success: function (status, body) { success(path); }, fail, headers, multistatus: true, responseType: 'xml', body: `<?xml version="1.0" encoding="UTF-8"?> <d:acl xmlns:d="DAV:"> ${aces.map(ace => `<d:ace> <d:principal> <d:href>${ace.principal}</d:href> </d:principal> <d:${ace.grantdeny || "grant"}> ${ace.privileges.map(priv => "<d:privilege><d:" + priv + "></d:" + priv + "></d:privilege>").join("/n")} </d:${ace.grantdeny || "grant"}> ${ace.password ? "<d:password>" + ace.password + "</d:password>" : ""} ${ace.expirationDate ? "<d:expirationDate>" + ace.expirationDate + "</d:expirationDate>" : ""} ${ace.invitationList ? "<d:invitationList>" + ace.invitationList.map(i => "<d:email>" + i + "</d:email>").join("\n") + "</d:invitationList>" : ""} </d:ace>`).join("\n")} </d:acl>` }); } exports.default = acl;