Skip to content

Module for easily setting web page’s permissions policy.

License

Notifications You must be signed in to change notification settings

waughjai/permissions-policy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Permissions Policy

Module for easily setting web page’s permissions policy.

Use

Just call static method “setPolicies” with associative array with valid policy types. Policy types not set will default to empty (disabled).

Call “createPolicies” to return header string rather than setting header, which can be used for testing purposes before setting header.

Example

use WaughJ\PermissionsPolicy\PermissionsPolicy;

PermissionsPolicy::setPolicies
([
    'accelerometer' => 'self',
    'autoplay' => 'https://www.jaimeson-waugh.com',
    'camera' => [ 'self' ],
    'geolocation' => [ 'self', 'https://www.jaimeson-waugh.com' ],
    'gyroscope' => true,
    'fullscreen' => '*'
]);

/*
    Will set header 'permissions-policy: permissions-policy: accelerometer=self,
    autoplay=(), camera=(self), document-domain=(), encrypted-media=(),
    fullscreen=*, geolocation=(self "https://www.jaimeson-waugh.com"),
    gyroscope=*, magnetometer=(), microphone=(), midi=(), payment=(),
    picture-in-picture=(), sync-xhr=(), usb=(), xr-spatial-tracking=()'
*/

Changelog

0.1.0

  • Initial Version

About

Module for easily setting web page’s permissions policy.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages