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kI,GACHxK,EAAQyK,KAAK,iDAAkDD,GAC3DX,IACAa,EAAAA,EAAAA,KAAUH,EAAAA,EAAAA,IAAE,gBAAiB,kDAErC,CAEJ,MAAMI,EAAQ,IAAIC,WAAW,IACvBC,EAAQlB,EAAYI,OAAS,IACnCe,KAAKC,OAAOC,gBAAgBL,GAC5B,IAAIrI,EAAW,GACf,IAAK,IAAIoC,EAAI,EAAGA,EAAIiG,EAAMZ,OAAQrF,IAC9BpC,GAAYqH,EAAYsB,OAAON,EAAMjG,GAAKmG,GAE9C,OAAOvI,CACX,C","sources":["webpack:///nextcloud/apps/files_sharing/src/models/Share.js","webpack:///nextcloud/apps/files_sharing/src/services/ConfigService.ts","webpack:///nextcloud/apps/files_sharing/src/utils/GeneratePassword.ts"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nexport default class Share {\n\n\t_share\n\n\t/**\n\t * Create the share object\n\t *\n\t * @param {object} ocsData ocs request response\n\t */\n\tconstructor(ocsData) {\n\t\tif (ocsData.ocs && ocsData.ocs.data && ocsData.ocs.data[0]) {\n\t\t\tocsData = ocsData.ocs.data[0]\n\t\t}\n\n\t\t// convert int into boolean\n\t\tocsData.hide_download = !!ocsData.hide_download\n\t\tocsData.mail_send = !!ocsData.mail_send\n\n\t\tif (ocsData.attributes && typeof ocsData.attributes === 'string') {\n\t\t\ttry {\n\t\t\t\tocsData.attributes = JSON.parse(ocsData.attributes)\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn('Could not parse share attributes returned by server', ocsData.attributes)\n\t\t\t}\n\t\t}\n\t\tocsData.attributes = ocsData.attributes ?? []\n\n\t\t// store state\n\t\tthis._share = ocsData\n\t}\n\n\t/**\n\t * Get the share state\n\t * ! used for reactivity purpose\n\t * Do not remove. It allow vuejs to\n\t * inject its watchers into the #share\n\t * state and make the whole class reactive\n\t *\n\t * @return {object} the share raw state\n\t * @readonly\n\t * @memberof Sidebar\n\t */\n\tget state() {\n\t\treturn this._share\n\t}\n\n\t/**\n\t * get the share id\n\t *\n\t * @return {number}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget id() {\n\t\treturn this._share.id\n\t}\n\n\t/**\n\t * Get the share type\n\t *\n\t * @return {number}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget type() {\n\t\treturn this._share.share_type\n\t}\n\n\t/**\n\t * Get the share permissions\n\t * See OC.PERMISSION_* variables\n\t *\n\t * @return {number}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget permissions() {\n\t\treturn this._share.permissions\n\t}\n\n\t/**\n\t * Get the share attributes\n\t *\n\t * @return {Array}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget attributes() {\n\t\treturn this._share.attributes\n\t}\n\n\t/**\n\t * Set the share permissions\n\t * See OC.PERMISSION_* variables\n\t *\n\t * @param {number} permissions valid permission, See OC.PERMISSION_* variables\n\t * @memberof Share\n\t */\n\tset permissions(permissions) {\n\t\tthis._share.permissions = permissions\n\t}\n\n\t// SHARE OWNER --------------------------------------------------\n\t/**\n\t * Get the share owner uid\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget owner() {\n\t\treturn this._share.uid_owner\n\t}\n\n\t/**\n\t * Get the share owner's display name\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget ownerDisplayName() {\n\t\treturn this._share.displayname_owner\n\t}\n\n\t// SHARED WITH --------------------------------------------------\n\t/**\n\t * Get the share with entity uid\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget shareWith() {\n\t\treturn this._share.share_with\n\t}\n\n\t/**\n\t * Get the share with entity display name\n\t * fallback to its uid if none\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget shareWithDisplayName() {\n\t\treturn this._share.share_with_displayname\n\t\t\t|| this._share.share_with\n\t}\n\n\t/**\n\t * Unique display name in case of multiple\n\t * duplicates results with the same name.\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget shareWithDisplayNameUnique() {\n\t\treturn this._share.share_with_displayname_unique\n\t\t\t|| this._share.share_with\n\t}\n\n\t/**\n\t * Get the share with entity link\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget shareWithLink() {\n\t\treturn this._share.share_with_link\n\t}\n\n\t/**\n\t * Get the share with avatar if any\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget shareWithAvatar() {\n\t\treturn this._share.share_with_avatar\n\t}\n\n\t// SHARED FILE OR FOLDER OWNER ----------------------------------\n\t/**\n\t * Get the shared item owner uid\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget uidFileOwner() {\n\t\treturn this._share.uid_file_owner\n\t}\n\n\t/**\n\t * Get the shared item display name\n\t * fallback to its uid if none\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget displaynameFileOwner() {\n\t\treturn this._share.displayname_file_owner\n\t\t\t|| this._share.uid_file_owner\n\t}\n\n\t// TIME DATA ----------------------------------------------------\n\t/**\n\t * Get the share creation timestamp\n\t *\n\t * @return {number}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget createdTime() {\n\t\treturn this._share.stime\n\t}\n\n\t/**\n\t * Get the expiration date\n\t *\n\t * @return {string} date with YYYY-MM-DD format\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget expireDate() {\n\t\treturn this._share.expiration\n\t}\n\n\t/**\n\t * Set the expiration date\n\t *\n\t * @param {string} date the share expiration date with YYYY-MM-DD format\n\t * @memberof Share\n\t */\n\tset expireDate(date) {\n\t\tthis._share.expiration = date\n\t}\n\n\t// EXTRA DATA ---------------------------------------------------\n\t/**\n\t * Get the public share token\n\t *\n\t * @return {string} the token\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget token() {\n\t\treturn this._share.token\n\t}\n\n\t/**\n\t * Get the share note if any\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget note() {\n\t\treturn this._share.note\n\t}\n\n\t/**\n\t * Set the share note if any\n\t *\n\t * @param {string} note the note\n\t * @memberof Share\n\t */\n\tset note(note) {\n\t\tthis._share.note = note\n\t}\n\n\t/**\n\t * Get the share label if any\n\t * Should only exist on link shares\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget label() {\n\t\treturn this._share.label ?? ''\n\t}\n\n\t/**\n\t * Set the share label if any\n\t * Should only be set on link shares\n\t *\n\t * @param {string} label the label\n\t * @memberof Share\n\t */\n\tset label(label) {\n\t\tthis._share.label = label\n\t}\n\n\t/**\n\t * Have a mail been sent\n\t *\n\t * @return {boolean}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget mailSend() {\n\t\treturn this._share.mail_send === true\n\t}\n\n\t/**\n\t * Hide the download button on public page\n\t *\n\t * @return {boolean}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget hideDownload() {\n\t\treturn this._share.hide_download === true\n\t}\n\n\t/**\n\t * Hide the download button on public page\n\t *\n\t * @param {boolean} state hide the button ?\n\t * @memberof Share\n\t */\n\tset hideDownload(state) {\n\t\tthis._share.hide_download = state === true\n\t}\n\n\t/**\n\t * Password protection of the share\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget password() {\n\t\treturn this._share.password\n\t}\n\n\t/**\n\t * Password protection of the share\n\t *\n\t * @param {string} password the share password\n\t * @memberof Share\n\t */\n\tset password(password) {\n\t\tthis._share.password = password\n\t}\n\n\t/**\n\t * Password expiration time\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget passwordExpirationTime() {\n\t\treturn this._share.password_expiration_time\n\t}\n\n\t/**\n\t * Password expiration time\n\t *\n\t * @param {string} password expiration time\n\t * @memberof Share\n\t */\n\tset passwordExpirationTime(passwordExpirationTime) {\n\t\tthis._share.password_expiration_time = passwordExpirationTime\n\t}\n\n\t/**\n\t * Password protection by Talk of the share\n\t *\n\t * @return {boolean}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget sendPasswordByTalk() {\n\t\treturn this._share.send_password_by_talk\n\t}\n\n\t/**\n\t * Password protection by Talk of the share\n\t *\n\t * @param {boolean} sendPasswordByTalk whether to send the password by Talk\n\t * or not\n\t * @memberof Share\n\t */\n\tset sendPasswordByTalk(sendPasswordByTalk) {\n\t\tthis._share.send_password_by_talk = sendPasswordByTalk\n\t}\n\n\t// SHARED ITEM DATA ---------------------------------------------\n\t/**\n\t * Get the shared item absolute full path\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget path() {\n\t\treturn this._share.path\n\t}\n\n\t/**\n\t * Return the item type: file or folder\n\t *\n\t * @return {string} 'folder' or 'file'\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget itemType() {\n\t\treturn this._share.item_type\n\t}\n\n\t/**\n\t * Get the shared item mimetype\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget mimetype() {\n\t\treturn this._share.mimetype\n\t}\n\n\t/**\n\t * Get the shared item id\n\t *\n\t * @return {number}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget fileSource() {\n\t\treturn this._share.file_source\n\t}\n\n\t/**\n\t * Get the target path on the receiving end\n\t * e.g the file /xxx/aaa will be shared in\n\t * the receiving root as /aaa, the fileTarget is /aaa\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget fileTarget() {\n\t\treturn this._share.file_target\n\t}\n\n\t/**\n\t * Get the parent folder id if any\n\t *\n\t * @return {number}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget fileParent() {\n\t\treturn this._share.file_parent\n\t}\n\n\t// PERMISSIONS Shortcuts\n\n\t/**\n\t * Does this share have READ permissions\n\t *\n\t * @return {boolean}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget hasReadPermission() {\n\t\treturn !!((this.permissions & OC.PERMISSION_READ))\n\t}\n\n\t/**\n\t * Does this share have CREATE permissions\n\t *\n\t * @return {boolean}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget hasCreatePermission() {\n\t\treturn !!((this.permissions & OC.PERMISSION_CREATE))\n\t}\n\n\t/**\n\t * Does this share have DELETE permissions\n\t *\n\t * @return {boolean}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget hasDeletePermission() {\n\t\treturn !!((this.permissions & OC.PERMISSION_DELETE))\n\t}\n\n\t/**\n\t * Does this share have UPDATE permissions\n\t *\n\t * @return {boolean}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget hasUpdatePermission() {\n\t\treturn !!((this.permissions & OC.PERMISSION_UPDATE))\n\t}\n\n\t/**\n\t * Does this share have SHARE permissions\n\t *\n\t * @return {boolean}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget hasSharePermission() {\n\t\treturn !!((this.permissions & OC.PERMISSION_SHARE))\n\t}\n\n\t/**\n\t * Does this share have download permissions\n\t *\n\t * @return {boolean}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget hasDownloadPermission() {\n\t\tconst hasDisabledDownload = (attribute) => {\n\t\t\treturn attribute.scope === 'permissions' && attribute.key === 'download' && attribute.value === false\n\t\t}\n\t\treturn this.attributes.some(hasDisabledDownload)\n\t}\n\n\t/**\n\t * Is this mail share a file request ?\n\t *\n\t * @return {boolean}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget isFileRequest() {\n\t\tconst isFileRequest = (attribute) => {\n\t\t\treturn attribute.scope === 'fileRequest' && attribute.key === 'enabled' && attribute.value === true\n\t\t}\n\t\treturn this.attributes.some(isFileRequest)\n\t}\n\n\tset hasDownloadPermission(enabled) {\n\t\tthis.setAttribute('permissions', 'download', !!enabled)\n\t}\n\n\tsetAttribute(scope, key, value) {\n\t\tconst attrUpdate = {\n\t\t\tscope,\n\t\t\tkey,\n\t\t\tvalue,\n\t\t}\n\n\t\t// try and replace existing\n\t\tfor (const i in this._share.attributes) {\n\t\t\tconst attr = this._share.attributes[i]\n\t\t\tif (attr.scope === attrUpdate.scope && attr.key === attrUpdate.key) {\n\t\t\t\tthis._share.attributes.splice(i, 1, attrUpdate)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tthis._share.attributes.push(attrUpdate)\n\t}\n\n\t// PERMISSIONS Shortcuts for the CURRENT USER\n\t// ! the permissions above are the share settings,\n\t// ! meaning the permissions for the recipient\n\t/**\n\t * Can the current user EDIT this share ?\n\t *\n\t * @return {boolean}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget canEdit() {\n\t\treturn this._share.can_edit === true\n\t}\n\n\t/**\n\t * Can the current user DELETE this share ?\n\t *\n\t * @return {boolean}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget canDelete() {\n\t\treturn this._share.can_delete === true\n\t}\n\n\t/**\n\t * Top level accessible shared folder fileid for the current user\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget viaFileid() {\n\t\treturn this._share.via_fileid\n\t}\n\n\t/**\n\t * Top level accessible shared folder path for the current user\n\t *\n\t * @return {string}\n\t * @readonly\n\t * @memberof Share\n\t */\n\tget viaPath() {\n\t\treturn this._share.via_path\n\t}\n\n\t// TODO: SORT THOSE PROPERTIES\n\n\tget parent() {\n\t\treturn this._share.parent\n\t}\n\n\tget storageId() {\n\t\treturn this._share.storage_id\n\t}\n\n\tget storage() {\n\t\treturn this._share.storage\n\t}\n\n\tget itemSource() {\n\t\treturn this._share.item_source\n\t}\n\n\tget status() {\n\t\treturn this._share.status\n\t}\n\n}\n","/**\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { getCapabilities } from '@nextcloud/capabilities';\nexport default class Config {\n _capabilities;\n constructor() {\n this._capabilities = getCapabilities();\n }\n /**\n * Get default share permissions, if any\n */\n get defaultPermissions() {\n return this._capabilities.files_sharing?.default_permissions;\n }\n /**\n * Is public upload allowed on link shares ?\n * This covers File request and Full upload/edit option.\n */\n get isPublicUploadEnabled() {\n return this._capabilities.files_sharing?.public?.upload === true;\n }\n /**\n * Get the federated sharing documentation link\n */\n get federatedShareDocLink() {\n return window.OC.appConfig.core.federatedCloudShareDoc;\n }\n /**\n * Get the default link share expiration date\n */\n get defaultExpirationDate() {\n if (this.isDefaultExpireDateEnabled && this.defaultExpireDate !== null) {\n return new Date(new Date().setDate(new Date().getDate() + this.defaultExpireDate));\n }\n return null;\n }\n /**\n * Get the default internal expiration date\n */\n get defaultInternalExpirationDate() {\n if (this.isDefaultInternalExpireDateEnabled && this.defaultInternalExpireDate !== null) {\n return new Date(new Date().setDate(new Date().getDate() + this.defaultInternalExpireDate));\n }\n return null;\n }\n /**\n * Get the default remote expiration date\n */\n get defaultRemoteExpirationDateString() {\n if (this.isDefaultRemoteExpireDateEnabled && this.defaultRemoteExpireDate !== null) {\n return new Date(new Date().setDate(new Date().getDate() + this.defaultRemoteExpireDate));\n }\n return null;\n }\n /**\n * Are link shares password-enforced ?\n */\n get enforcePasswordForPublicLink() {\n return window.OC.appConfig.core.enforcePasswordForPublicLink === true;\n }\n /**\n * Is password asked by default on link shares ?\n */\n get enableLinkPasswordByDefault() {\n return window.OC.appConfig.core.enableLinkPasswordByDefault === true;\n }\n /**\n * Is link shares expiration enforced ?\n */\n get isDefaultExpireDateEnforced() {\n return window.OC.appConfig.core.defaultExpireDateEnforced === true;\n }\n /**\n * Is there a default expiration date for new link shares ?\n */\n get isDefaultExpireDateEnabled() {\n return window.OC.appConfig.core.defaultExpireDateEnabled === true;\n }\n /**\n * Is internal shares expiration enforced ?\n */\n get isDefaultInternalExpireDateEnforced() {\n return window.OC.appConfig.core.defaultInternalExpireDateEnforced === true;\n }\n /**\n * Is there a default expiration date for new internal shares ?\n */\n get isDefaultInternalExpireDateEnabled() {\n return window.OC.appConfig.core.defaultInternalExpireDateEnabled === true;\n }\n /**\n * Is remote shares expiration enforced ?\n */\n get isDefaultRemoteExpireDateEnforced() {\n return window.OC.appConfig.core.defaultRemoteExpireDateEnforced === true;\n }\n /**\n * Is there a default expiration date for new remote shares ?\n */\n get isDefaultRemoteExpireDateEnabled() {\n return window.OC.appConfig.core.defaultRemoteExpireDateEnabled === true;\n }\n /**\n * Are users on this server allowed to send shares to other servers ?\n */\n get isRemoteShareAllowed() {\n return window.OC.appConfig.core.remoteShareAllowed === true;\n }\n /**\n * Is sharing my mail (link share) enabled ?\n */\n get isMailShareAllowed() {\n // eslint-disable-next-line camelcase\n return this._capabilities?.files_sharing?.sharebymail?.enabled === true\n // eslint-disable-next-line camelcase\n && this._capabilities?.files_sharing?.public?.enabled === true;\n }\n /**\n * Get the default days to link shares expiration\n */\n get defaultExpireDate() {\n return window.OC.appConfig.core.defaultExpireDate;\n }\n /**\n * Get the default days to internal shares expiration\n */\n get defaultInternalExpireDate() {\n return window.OC.appConfig.core.defaultInternalExpireDate;\n }\n /**\n * Get the default days to remote shares expiration\n */\n get defaultRemoteExpireDate() {\n return window.OC.appConfig.core.defaultRemoteExpireDate;\n }\n /**\n * Is resharing allowed ?\n */\n get isResharingAllowed() {\n return window.OC.appConfig.core.resharingAllowed === true;\n }\n /**\n * Is password enforced for mail shares ?\n */\n get isPasswordForMailSharesRequired() {\n return this._capabilities.files_sharing?.sharebymail?.password?.enforced === true;\n }\n /**\n * Always show the email or userid unique sharee label if enabled by the admin\n */\n get shouldAlwaysShowUnique() {\n return this._capabilities.files_sharing?.sharee?.always_show_unique === true;\n }\n /**\n * Is sharing with groups allowed ?\n */\n get allowGroupSharing() {\n return window.OC.appConfig.core.allowGroupSharing === true;\n }\n /**\n * Get the maximum results of a share search\n */\n get maxAutocompleteResults() {\n return parseInt(window.OC.config['sharing.maxAutocompleteResults'], 10) || 25;\n }\n /**\n * Get the minimal string length\n * to initiate a share search\n */\n get minSearchStringLength() {\n return parseInt(window.OC.config['sharing.minSearchStringLength'], 10) || 0;\n }\n /**\n * Get the password policy configuration\n */\n get passwordPolicy() {\n return this._capabilities?.password_policy || {};\n }\n}\n","/**\n * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport axios from '@nextcloud/axios';\nimport Config from '../services/ConfigService.ts';\nimport { showError, showSuccess } from '@nextcloud/dialogs';\nimport { translate as t } from '@nextcloud/l10n';\nconst config = new Config();\n// note: some chars removed on purpose to make them human friendly when read out\nconst passwordSet = 'abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789';\n/**\n * Generate a valid policy password or\n * request a valid password if password_policy\n * is enabled\n */\nexport default async function (verbose = false) {\n // password policy is enabled, let's request a pass\n if (config.passwordPolicy.api && config.passwordPolicy.api.generate) {\n try {\n const request = await axios.get(config.passwordPolicy.api.generate);\n if (request.data.ocs.data.password) {\n if (verbose) {\n showSuccess(t('files_sharing', 'Password created successfully'));\n }\n return request.data.ocs.data.password;\n }\n }\n catch (error) {\n console.info('Error generating password from password_policy', error);\n if (verbose) {\n showError(t('files_sharing', 'Error generating password from password policy'));\n }\n }\n }\n const array = new Uint8Array(10);\n const ratio = passwordSet.length / 255;\n self.crypto.getRandomValues(array);\n let password = '';\n for (let i = 0; i < array.length; i++) {\n password += passwordSet.charAt(array[i] * ratio);\n }\n return password;\n}\n"],"names":["Share","constructor","ocsData","_ocsData$attributes","ocs","data","hide_download","mail_send","attributes","JSON","parse","e","console","warn","this","_share","state","id","type","share_type","permissions","owner","uid_owner","ownerDisplayName","displayname_owner","shareWith","share_with","shareWithDisplayName","share_with_displayname","shareWithDisplayNameUnique","share_with_displayname_unique","shareWithLink","share_with_link","shareWithAvatar","share_with_avatar","uidFileOwner","uid_file_owner","displaynameFileOwner","displayname_file_owner","createdTime","stime","expireDate","expiration","date","token","note","label","_this$_share$label","mailSend","hideDownload","password","passwordExpirationTime","password_expiration_time","sendPasswordByTalk","send_password_by_talk","path","itemType","item_type","mimetype","fileSource","file_source","fileTarget","file_target","fileParent","file_parent","hasReadPermission","OC","PERMISSION_READ","hasCreatePermission","PERMISSION_CREATE","hasDeletePermission","PERMISSION_DELETE","hasUpdatePermission","PERMISSION_UPDATE","hasSharePermission","PERMISSION_SHARE","hasDownloadPermission","some","attribute","scope","key","value","isFileRequest","enabled","setAttribute","attrUpdate","i","attr","splice","push","canEdit","can_edit","canDelete","can_delete","viaFileid","via_fileid","viaPath","via_path","parent","storageId","storage_id","storage","itemSource","item_source","status","Config","_capabilities","getCapabilities","defaultPermissions","_this$_capabilities$f","files_sharing","default_permissions","isPublicUploadEnabled","_this$_capabilities$f2","public","upload","federatedShareDocLink","window","appConfig","core","federatedCloudShareDoc","defaultExpirationDate","isDefaultExpireDateEnabled","defaultExpireDate","Date","setDate","getDate","defaultInternalExpirationDate","isDefaultInternalExpireDateEnabled","defaultInternalExpireDate","defaultRemoteExpirationDateString","isDefaultRemoteExpireDateEnabled","defaultRemoteExpireDate","enforcePasswordForPublicLink","enableLinkPasswordByDefault","isDefaultExpireDateEnforced","defaultExpireDateEnforced","defaultExpireDateEnabled","isDefaultInternalExpireDateEnforced","defaultInternalExpireDateEnforced","defaultInternalExpireDateEnabled","isDefaultRemoteExpireDateEnforced","defaultRemoteExpireDateEnforced","defaultRemoteExpireDateEnabled","isRemoteShareAllowed","remoteShareAllowed","isMailShareAllowed","_this$_capabilities","_this$_capabilities2","sharebymail","isResharingAllowed","resharingAllowed","isPasswordForMailSharesRequired","_this$_capabilities$f3","enforced","shouldAlwaysShowUnique","_this$_capabilities$f4","sharee","always_show_unique","allowGroupSharing","maxAutocompleteResults","parseInt","config","minSearchStringLength","passwordPolicy","_this$_capabilities3","password_policy","passwordSet","async","verbose","arguments","length","undefined","api","generate","request","axios","get","showSuccess","t","error","info","showError","array","Uint8Array","ratio","self","crypto","getRandomValues","charAt"],"sourceRoot":""}
|