mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-23 22:40:20 +08:00
Cleanup
This commit is contained in:
parent
90ce840234
commit
38e8b19b50
@ -60,7 +60,6 @@ class LLRead extends LLFilesystemOperation {
|
|||||||
const svc_acl = context.get('services').get('acl');
|
const svc_acl = context.get('services').get('acl');
|
||||||
const { fsNode, actor } = a.values();
|
const { fsNode, actor } = a.values();
|
||||||
if ( ! await svc_acl.check(actor, fsNode, 'read') ) {
|
if ( ! await svc_acl.check(actor, fsNode, 'read') ) {
|
||||||
console.log('\x1B[36;1mACL CHECK FAILED', { actor, fsNode });
|
|
||||||
throw await svc_acl.get_safe_acl_error(actor, fsNode, 'read');
|
throw await svc_acl.get_safe_acl_error(actor, fsNode, 'read');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -76,25 +76,6 @@ class ACLService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hard rule: if actor is owner, allow
|
|
||||||
// if ( actor.type instanceof UserActorType ) {
|
|
||||||
// const owner = await fsNode.get('user_id');
|
|
||||||
// if ( this.verbose ) {
|
|
||||||
// const user = await get_user({ id: owner });
|
|
||||||
// this.log.info(
|
|
||||||
// `user ${user.username} is ` +
|
|
||||||
// (owner == actor.type.user.id ? '' : 'not ') +
|
|
||||||
// 'owner of ' + await fsNode.get('path'), {
|
|
||||||
// actor_user_id: actor.type.user.id,
|
|
||||||
// fsnode_user_id: owner,
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// if ( owner == actor.type.user.id ) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// app-under-user only works if the user also has permission
|
// app-under-user only works if the user also has permission
|
||||||
if ( actor.type instanceof AppUnderUserActorType ) {
|
if ( actor.type instanceof AppUnderUserActorType ) {
|
||||||
const user_actor = new Actor({
|
const user_actor = new Actor({
|
||||||
|
@ -221,9 +221,7 @@ class PermissionService extends BaseService {
|
|||||||
|
|
||||||
// TODO: context meta for cycle detection
|
// TODO: context meta for cycle detection
|
||||||
async check_user_permission (actor, permission) {
|
async check_user_permission (actor, permission) {
|
||||||
this.log.noticeme('check input: ' + permission);
|
|
||||||
permission = await this._rewrite_permission(permission);
|
permission = await this._rewrite_permission(permission);
|
||||||
this.log.noticeme('check output: ' + permission);
|
|
||||||
const parent_perms = this.get_parent_permissions(permission);
|
const parent_perms = this.get_parent_permissions(permission);
|
||||||
|
|
||||||
// Check implicit permissions
|
// Check implicit permissions
|
||||||
@ -266,7 +264,6 @@ class PermissionService extends BaseService {
|
|||||||
|
|
||||||
const issuer_perm = await this.check(issuer_actor, row.permission);
|
const issuer_perm = await this.check(issuer_actor, row.permission);
|
||||||
|
|
||||||
this.log.noticeme('issuer_perm', { row, issuer_perm });
|
|
||||||
if ( ! issuer_perm ) continue;
|
if ( ! issuer_perm ) continue;
|
||||||
|
|
||||||
return row.extra;
|
return row.extra;
|
||||||
@ -474,13 +471,7 @@ class PermissionService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async grant_user_user_permission (actor, username, permission, extra = {}, meta) {
|
async grant_user_user_permission (actor, username, permission, extra = {}, meta) {
|
||||||
this.log.noticeme('input permission: ' + permission);
|
|
||||||
permission = await this._rewrite_permission(permission);
|
permission = await this._rewrite_permission(permission);
|
||||||
this.log.noticeme('output permission: ' + permission);
|
|
||||||
this.log.noticeme('fields', {
|
|
||||||
one_thing: 1,
|
|
||||||
another: 2
|
|
||||||
});
|
|
||||||
const user = await get_user({ username });
|
const user = await get_user({ username });
|
||||||
if ( ! user ) {
|
if ( ! user ) {
|
||||||
throw new Error('user not found');
|
throw new Error('user not found');
|
||||||
@ -534,8 +525,6 @@ class PermissionService extends BaseService {
|
|||||||
throw new Error('user not found');
|
throw new Error('user not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('revoking', user.id, actor.type.user.id, permission)
|
|
||||||
|
|
||||||
// DELETE permission
|
// DELETE permission
|
||||||
await this.db.write(
|
await this.db.write(
|
||||||
'DELETE FROM `user_to_user_permissions` ' +
|
'DELETE FROM `user_to_user_permissions` ' +
|
||||||
|
Loading…
Reference in New Issue
Block a user