diff options
author | DNW <dnw.ftw@gmail.com> | 2011-08-29 23:58:32 +0400 |
---|---|---|
committer | DNW <dnw.ftw@gmail.com> | 2011-10-01 20:37:48 +0400 |
commit | a8975fe6bc7cecd2b3e42dd61cb929788e8f006b (patch) | |
tree | 74ea02cb7dd475200f2817b1fce2cdd23ce0444f /src/murmur/MurmurIceWrapper.cpp | |
parent | 0e4d963a5a762520945d01a328d17688fb6c2fd8 (diff) |
Add Server::effectivePermissions() to ICE (https://sourceforge.net/tracker/?func=detail&aid=3389065&group_id=147372&atid=768008)
Diffstat (limited to 'src/murmur/MurmurIceWrapper.cpp')
-rw-r--r-- | src/murmur/MurmurIceWrapper.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/murmur/MurmurIceWrapper.cpp b/src/murmur/MurmurIceWrapper.cpp index 87286f071..8fe93a87a 100644 --- a/src/murmur/MurmurIceWrapper.cpp +++ b/src/murmur/MurmurIceWrapper.cpp @@ -749,6 +749,36 @@ void ::Murmur::ServerI::hasPermission_async(const ::Murmur::AMD_Server_hasPermis QCoreApplication::instance()->postEvent(mi, ie); } +void ::Murmur::ServerI::effectivePermissions_async(const ::Murmur::AMD_Server_effectivePermissionsPtr &cb, ::Ice::Int p1, ::Ice::Int p2, const ::Ice::Current ¤t) { + // qWarning() << effectivePermissions << meta->mp.qsIceSecretRead.isNull() << meta->mp.qsIceSecretRead.isEmpty(); +#ifndef ACCESS_Server_effectivePermissions_ALL +#ifdef ACCESS_Server_effectivePermissions_READ + if ( !meta->mp.qsIceSecretRead.isNull()) { + bool ok = ! meta->mp.qsIceSecretRead.isEmpty(); +#else + if (! meta->mp.qsIceSecretRead.isNull() ||! meta->mp.qsIceSecretWrite.isNull()) { + bool ok = ! meta->mp.qsIceSecretWrite.isEmpty(); +#endif + ::Ice::Context::const_iterator i = current.ctx.find("secret"); + ok = ok && (i != current.ctx.end()); + if (ok) { + const QString &secret = u8((*i).second); +#ifdef ACCESS_Server_effectivePermissions_READ + ok = ((secret == meta->mp.qsIceSecretRead) ||(secret == meta->mp.qsIceSecretWrite)); +#else + ok = (secret == meta->mp.qsIceSecretWrite); +#endif + } + if (! ok) { + cb->ice_exception(InvalidSecretException()); + return; + } + } +#endif + ExecEvent *ie = new ExecEvent(boost::bind(&impl_Server_effectivePermissions, cb, QString::fromStdString(current.id.name).toInt(), p1, p2)); + QCoreApplication::instance()->postEvent(mi, ie); +} + void ::Murmur::ServerI::addContextCallback_async(const ::Murmur::AMD_Server_addContextCallbackPtr &cb, ::Ice::Int p1, const ::std::string& p2, const ::std::string& p3, const ::Murmur::ServerContextCallbackPrx& p4, ::Ice::Int p5, const ::Ice::Current ¤t) { // qWarning() << "addContextCallback" << meta->mp.qsIceSecretRead.isNull() << meta->mp.qsIceSecretRead.isEmpty(); #ifndef ACCESS_Server_addContextCallback_ALL |