Fix user permission grant issue
This commit is contained in:
parent
ffb5e35205
commit
572edda4ae
@ -65,7 +65,7 @@ class Page extends Controller {
|
||||
const user = req.user
|
||||
let { page } = req.form
|
||||
|
||||
const level = await page.access_level_for(req.user)
|
||||
const level = await page.access_level_for(user)
|
||||
|
||||
const version_num = req.body.version || req.query.version
|
||||
if ( version_num ) {
|
||||
@ -252,8 +252,6 @@ class Page extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
// console.log('updated nodes', updated_nodes)
|
||||
|
||||
let delete_nodes = nodes
|
||||
for ( const node of updated_nodes ) {
|
||||
await node.version_save(`Contents saved in page "${page.Name}"`, req.user.id)
|
||||
|
@ -83,6 +83,12 @@ class User extends AuthUser {
|
||||
const PublicUserPermission = this.models.get('auth:PublicUserPermission')
|
||||
return await PublicUserPermission.can(permission)
|
||||
}
|
||||
|
||||
allow(permission, force = false){
|
||||
// Need to check super.can, since this.can is async.
|
||||
// This will exclude public user permissions, which is the behavior we want anyway.
|
||||
if ( !super.can(permission) || (force && !this.permissions.includes(permission)) ) this.permissions.push(permission)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user