@personaspace/server-acl-middleware
v0.1.2
Published
A package containing default middleware and handling of middleware for PersonaSpace Node.js servers.
Downloads
19
Maintainers
Readme
PersonaSpace ACL Middleware
For Node.js server
A package containing default middleware and handling of middleware for PersonaSpace Node.js servers.
PersonaSpace uses a powerful ACL implementation that give an owner unparalleled control over which visitors can interact with their data, where visitors can access their data from, and when visitors can access it. @personaspace/server-acl-middleware
contains the ACL middleware that can modify an ACL dynamically based on request data, date, time, etc...
This package provides only the middleware ACLs. The @personaspace/server-acl
package handles resolution of ACLs of a visitor's access to the data. The @personaspace/server-resource
package handles validation of the visitor's access to the data.
Installation
Install @personaspace/server-acl-middleware
using npm.
npm i @personaspace/server-acl-middleware
Usage
// "request" is the web request on a PersonaSpace server.
import { processMiddleware } from "@personaspace/server-acl-middleware";
import { onDomain } from "@personaspace/server-acl-middleware-ondomain";
const req = { headers: { host: "example.com" } };
const permissions = {
create: {
enforce: false,
result: true,
},
read: {
enforce: true,
result: false,
},
};
const permObjs = [
{
enforce: true,
middleware: "onDomain",
params: ["example.com"],
result: false,
},
{
enforce: false,
result: true,
},
];
processMiddleware(req, "create", permissions, permObjs, [onDomain]);
Documentation
Documentation is located at https://personaspace.github.io/node-server-acl-middleware. For issues with the documentation, please Create a new issue.
Contributing to PersonaSpace
PersonaSpace is a large project and contributors are welcome. Thank you for your support and efforts!
There are a lot of ways to contribute:
- Create a new issue to report bugs or request features
- Fix an issue
Be sure to look at CONTRIBUTING.md.
License
PersonaSpace is licensed under the MIT License.