- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
function checkAccess(options, a, b) {
const access = this.modules.access
for (let key in options) {
const decorator = access[key]
if (decorator) {
try {
const v = decorator.call(this, options[key], a, b)
if (v) {
return v
}
}
catch (error) {
error.decorator = key
return {
code: 500,
error
}
}
}
else {
return {
code: 500,
error: {
decorator: key,
message: 'No such decorator'
}
}
}
}
}
function callAction(self, module, actionName, a, b) {
const action = module[actionName]
if (action instanceof Function) {
return checkAccess.call(self, module.$call, a, b)
|| checkAccess.call(self, module['$' + actionName], a, b)
|| action.call(self, a, b)
}
else {
throw new Error('No such action: ' + actionName)
}
}
huesto 30.01.2017 19:00 # 0
Щито?
bormand 30.01.2017 19:01 # 0
Упс. Видимо, просто забыли скопипастить (см. строку 23).
Cyanide 24.08.2021 00:57 # 0