MCPcopy Create free account
hub / github.com/LibPDF-js/core / getPermissions

Method getPermissions

src/api/pdf.ts:847–860  ·  view source on GitHub ↗

* Get the current permission flags. * * Returns all permissions as true for unencrypted documents. * For encrypted documents authenticated with owner password, all are true. * * @returns Current permission flags * * @example * ```typescript * const perms = pdf.getPermissio

()

Source from the content-addressed store, hash-verified

845 * ```
846 */
847 getPermissions(): Permissions {
848 const handler = this.ctx.info.securityHandler;
849
850 if (!this.isEncrypted || !handler) {
851 return DEFAULT_PERMISSIONS;
852 }
853
854 // Owner access grants all permissions
855 if (handler.hasOwnerAccess) {
856 return DEFAULT_PERMISSIONS;
857 }
858
859 return handler.permissions;
860 }
861
862 /**
863 * Check if the document was authenticated with owner-level access.

Callers 2

mainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected