Now the challenge is: there are 2 functions. And there is a user who can only execute one of them. The question is how to do it? If you just write: box.schema.user.grant ('user', 'execute', 'function', 'dima', nil, {if_not_exists = true}) then the user 'user' cannot connect at all. An error message is displayed: Execute access to universe '' is denied for user 'user'. How to provide access correctly?
box.once("schema", function()
box.schema.user.create('superuser', {password = '11111111'})
box.schema.user.create('user', {password = '11111111'})
box.schema.user.grant('superuser', 'read,write,execute','universe', nil, {if_not_exists = true})
box.schema.user.grant('user','execute','function','dima',nil, {if_not_exists = true})
end)
function reload(proc)
package.loaded[proc]=nil return require(proc)
end
ws = reload('project/init')
Function dima:
local obj={}
function obj.open()
return 'dima'
end
return obj
Function dima2:
local obj={}
function obj.open()
return 'dima2'
end
return obj
Init.lua:
obj = {}
collectgarbage('collect')
net = require('net.box')
fiber = require('fiber')
uuid = require('uuid')
-- modules
obj.dima = reload('project/dima')
obj.dima2 = reload('project/dima2')
return obj