H5P-Nodejs-Library
  • README
  • Basic usage
    • Architecture
    • Integrating the core library
    • H5P Ajax Endpoints
    • Constructing H5PEditor
    • REST Example
  • Advanced usage
    • Authorization
    • User content state
    • Multiple user states per object
    • Impersonating users
    • Basic completion tracking
    • Localization
    • Cluster
    • Addons
    • Customization
    • Performance optimizations
    • Privacy
    • Forward proxy support
    • Security
  • NPM packages
    • h5p-mongos3
      • Mongo/S3 Content Storage
      • S3 Temporary File Storage
      • Mongo Library Storage
      • Mongo/S3 Library Storage
    • h5p-webcomponents
    • h5p-react
    • h5p-redis-lock
    • h5p-svg-sanitizer
    • h5p-clamav-scanner
  • Development
    • Getting started
    • Testing & code quality
    • Core updates
    • Project Status
Powered by GitBook
On this page

Was this helpful?

  1. Advanced usage

Authorization

PreviousAdvanced usageNextUser content state

Last updated 1 year ago

Was this helpful?

Many actions users perform in the H5P system need authorization. By default the library will allow everything to every user. You can customize who can do what, but passing in an implementation of IPermissionSystem into options.permissionSystem of the H5PPlayer or H5PEditor constructor. The library then calls the methods of IPermissionSystem whenever a user performs an action that requires authorization.

See the documentation of IPermissionSystem for and the for reference how to implement the permission system.

Note that the IPermissionSystem is a generic. You can use any sub-type of IUser as the generic type. The call of the methods of IPermissionSystem will include a user of the generic type. This is the user object you've injected in your controllers. That means you can add any arbitrary date to it, like roles.

Acknowledgement

The development of this feature was kindly funded by PHYWE Systeme GmbH und Co. KG (https://www.phywe.de/).

ExamplePermissionSystem