Commit 0d0f4d0e authored by Renato Figueiro Maia's avatar Renato Figueiro Maia
Browse files

[OPENBUS-2412] Notificação de observador legado (OpenBus 1.5) de logins falha...

[OPENBUS-2412] Notificação de observador legado (OpenBus 1.5) de logins falha após reinício do barramento

git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/openbus/core/branches/02_00_00@148115 ae0415b3-e90b-0410-900d-d0be9363c56b
parent 40486a44
......@@ -195,20 +195,8 @@ end
-- Credential Observation Support
local ObserverTranslator = class()
function ObserverTranslator:entityLogout(login)
self.observer:credentialWasDeleted{
identifier = login.id,
owner = login.entity,
delegate = "",
}
end
function IAccessControlService:addObserver(observer, loginIds)
observer = ObserverTranslator{ observer = observer }
local subscription = facets.LoginRegistry:subscribeObserver(observer)
local subscription = facets.LoginRegistry:subscribeObserver(observer, true)
subscription:watchLogins(loginIds)
return subscription.id
end
......
......@@ -66,6 +66,9 @@ local InvalidCertificate = mngexp.InvalidCertificate
local mngtyp = mngidl.types.services.access_control.admin.v1_0
local CertificateRegistryType = mngtyp.CertificateRegistry
local idl = require "openbus.core.legacy.idl"
local ICredentialObserver = idl.types.access_control_service.ICredentialObserver
local msg = require "openbus.core.services.messages"
local Logins = require "openbus.core.services.LoginDB"
......@@ -531,12 +534,22 @@ end
function LoginRegistry:loginRemoved(login, observers)
local orb = self.access.orb
for observer in pairs(observers) do
local iface, opname, param = LoginObserver, "entityLogout", login
if observer.legacy then
iface = ICredentialObserver
opname = "credentialWasDeleted"
param = {
identifier = login.id,
owner = login.entity,
delegate = "",
}
end
local callback = observer.callback
if callback == nil then
callback = orb:newproxy(observer.ior, nil, LoginObserver)
callback = orb:newproxy(observer.ior, nil, iface)
end
schedule(newthread(function()
local ok, errmsg = pcall(callback.entityLogout, callback, login)
local ok, errmsg = pcall(callback[opname], callback, param)
if not ok then
log:exception(msg.LoginObserverException:tag{
observer = observer.id,
......@@ -618,14 +631,14 @@ function LoginRegistry:getLoginValidity(id)
return 0
end
function LoginRegistry:subscribeObserver(callback)
function LoginRegistry:subscribeObserver(callback, legacy)
if callback == nil then
BAD_PARAM{ completed = "COMPLETED_NO", minor = 0 }
end
local logins = AccessControl.activeLogins
local caller = self.access:getCallerChain().caller
local login = logins:getLogin(caller.id)
local observer = login:newObserver(callback)
local observer = login:newObserver(callback, legacy)
observer.callback = callback
local id = observer.id
local subscription = Subscription{ id=id, logins=logins, registry=self }
......
......@@ -102,7 +102,7 @@ function Login:__init()
if self.observers == nil then self.observers = {} end
end
function Login:newObserver(callback)
function Login:newObserver(callback, legacy)
local base = self.base
local table = base.obsTab
local id = newid("time")
......@@ -111,6 +111,7 @@ function Login:newObserver(callback)
login = self.id,
watched = {},
ior = tostring(callback),
legacy = legacy,
}
assert(table:setentry(id, data))
data.callback = callback
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment