(grants = {})
| 894 | }; |
| 895 | |
| 896 | const expandCaps = (grants = {}) => { |
| 897 | const caps = {}; |
| 898 | const shareFile = !!(grants.shareFile || grants.share_file || grants.share); |
| 899 | const shareFolder = !!(grants.shareFolder || grants.share_folder || grants.share); |
| 900 | const writeMeta = !!grants.write; |
| 901 | |
| 902 | [ |
| 903 | 'view', 'viewOwn', 'manage', 'create', 'upload', 'edit', |
| 904 | 'rename', 'copy', 'move', 'delete', 'extract' |
| 905 | ].forEach(k => { if (grants[k]) caps[k] = true; }); |
| 906 | |
| 907 | if (shareFile) caps.shareFile = true; |
| 908 | if (shareFolder) caps.shareFolder = true; |
| 909 | if (writeMeta) caps.write = true; |
| 910 | if (grants.share) caps.share = true; |
| 911 | if (grants.owners) caps.owners = true; |
| 912 | if (grants.read) caps.read = true; |
| 913 | if (grants.read_own) caps.read_own = true; |
| 914 | |
| 915 | return caps; |
| 916 | }; |
| 917 | |
| 918 | const ancestors = (folder) => { |
| 919 | if (!folder || folder === 'root') return []; |
no outgoing calls
no test coverage detected