First commit
This commit is contained in:
66
framework/server/contract.js
Normal file
66
framework/server/contract.js
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2020, 2023, The Unified Company.
|
||||
|
||||
This code is part of Unify.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the ESA Software Community License - Strong Copyleft LICENSE,
|
||||
as published by the ESA.
|
||||
See the ESA Software Community License - Strong Copyleft LICENSE, for more details.
|
||||
|
||||
https://unifyjs.org
|
||||
|
||||
|
||||
Deprecated.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
import tools from '../unify/tools.js';
|
||||
|
||||
import rule from '../unify/contractRule.js';
|
||||
|
||||
export default class contract{
|
||||
|
||||
object = false;
|
||||
|
||||
rules = [];
|
||||
|
||||
constructor( object ) {
|
||||
|
||||
this.object = tools.serialize( object );
|
||||
|
||||
}
|
||||
|
||||
allow( right, object ){
|
||||
|
||||
var newRule = new rule();
|
||||
|
||||
newRule.type = "allow";
|
||||
|
||||
newRule.right = right;
|
||||
|
||||
newRule.object = tools.serialize( object );
|
||||
|
||||
this.rules.push( newRule );
|
||||
|
||||
}
|
||||
|
||||
deny() {
|
||||
|
||||
var newRule = new rule();
|
||||
|
||||
newRule.type = "deny";
|
||||
|
||||
newRule.right = right;
|
||||
|
||||
newRule.object = tools.serialize( object );
|
||||
|
||||
this.rules.push( newRule );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user