From 029fd83551338ea01613c54ddbc4906c09227c60 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Tue, 23 May 2006 12:23:55 +0000 Subject: Added support for Glacier2 filters. --- cpp/src/IceGrid/SessionI.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) (limited to 'cpp/src/IceGrid/SessionI.cpp') diff --git a/cpp/src/IceGrid/SessionI.cpp b/cpp/src/IceGrid/SessionI.cpp index f096ee3ff4f..21b10bc90f4 100644 --- a/cpp/src/IceGrid/SessionI.cpp +++ b/cpp/src/IceGrid/SessionI.cpp @@ -300,7 +300,32 @@ ClientSessionManagerI::ClientSessionManagerI(const DatabasePtr& database, int ti Glacier2::SessionPrx ClientSessionManagerI::create(const string& user, const Glacier2::SessionControlPrx& ctl, const Ice::Current& current) { - return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(create(user, ctl))); + Glacier2::SessionPrx s = Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(create(user, ctl))); + if(ctl) + { + try + { + // + // Restrict the objects the session is allowed to access to the session object itself, + // the query and registry objects. + // + Ice::IdentitySeq ids; + Ice::Identity id; + id.category = "IceGrid"; + id.name = "Query"; + ids.push_back(id); + id.name = "Registry"; + ids.push_back(id); + ids.push_back(s->ice_getIdentity()); + ctl->objectIdFilter()->addAccept(ids); + } + catch(const Ice::LocalException&) + { + s->destroy(); + return 0; + } + } + return s; } SessionIPtr @@ -338,5 +363,30 @@ ClientSSLSessionManagerI::create(const Glacier2::SSLInfo& info, const Glacier2:: } SessionIPtr session = new SessionI(userDN, _database, _timeout, _waitQueue, ctl); - return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(session)); + Glacier2::SessionPrx s = Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(session)); + if(ctl) + { + try + { + // + // Restrict the objects the session is allowed to access to the session object itself, + // the query and registry objects. + // + Ice::IdentitySeq ids; + Ice::Identity id; + id.category = "IceGrid"; + id.name = "Query"; + ids.push_back(id); + id.name = "Registry"; + ids.push_back(id); + ids.push_back(s->ice_getIdentity()); + ctl->objectIdFilter()->addAccept(ids); + } + catch(const Ice::LocalException&) + { + s->destroy(); + return 0; + } + } + return s; } -- cgit v1.2.3