- Restful Method
- Plugin Permission
npm i @wikoci/payloadjs
yarn @wikoci/payloadjs
import {Payload} from "@wikoci/payloadjs"
var payload =new Payload({
key:'',
apiURL:'',
mediaURL:'',
debug:true
})
payload.find("slug",params,options);
payload.findOne("slug",ID);
payload.find("slug",data,options);
payload.find("slug",ID,data,options);
payload.find("slug",ID);
payload.setToken();
payload.clearToken();
payload.raw(pipeline);
payload.aggregate("slug",pipeline);
This plugin active all feature : createdBy , updatedBy , and Permission utility.
** Notice: **
1- All slug contains users
are allowed to use permission plugins and authentication execpt default payload users.
Ex: customer-users , public-users , doa-users
//payload.config.js
import {setPermission ,setConfigPermission} from "@wikoci/payloadjs/plugin/permission"
const config ={
defaultPermission:{
slug: {
auth: ["create", "readAny"], // default permissions for Auth User : create | readAny | readOwn | deleteAny | deleteOwn | updateOwn | updateAny
public: ["readAny"], // No auth user readAny | createAny | deleteAny | updateAny,
readOnlyCreatedBy: true, // Admin UI
readOnlyUpdatedBy: true, // Admin UI
},
}
}
setConfigPermission(config) // Load permissions config before init plugin
plugins:[
setPermission
]