Author: mvidner Date: Wed Apr 15 16:22:12 2009 New Revision: 56794 URL: http://svn.opensuse.org/viewcvs/yast?rev=56794&view=rev Log: Fixed createActionId for PolKit and ModuleManager calls to match the .policy file. (broken after the MM objpath change in r56045) Modified: trunk/core/dbus/namespace_service/src/DBusModulesServer.cc Modified: trunk/core/dbus/namespace_service/src/DBusModulesServer.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/dbus/namespace_service/src/DBusModulesServer.cc?rev=56794&r1=56793&r2=56794&view=diff ============================================================================== --- trunk/core/dbus/namespace_service/src/DBusModulesServer.cc (original) +++ trunk/core/dbus/namespace_service/src/DBusModulesServer.cc Wed Apr 15 16:22:12 2009 @@ -599,36 +599,44 @@ DBusModulesServer::actionList DBusModulesServer::createActionId(const DBusMsg &msg) { // actionId: <prefix>.<namespace>.<method> - std::string ret(msg.interface() == YAST_DBUS_MGR_INTERFACE - ? YAST_POLKIT_PREFIX_MANAGER : YAST_POLKIT_PREFIX_MODULES); - - std::string obj(msg.path()); + std::string ret; + std::string method(msg.method()); - // convert object path "/org/opensuse/yast/Label" to PolKit path "Label" - if (!obj.empty()) + if (msg.interface() == YAST_DBUS_MGR_INTERFACE) { - if (obj[obj.size() - 1] == '/') - { - obj.erase(obj.size() - 1); - } - - obj.erase(0, obj.rfind("/")); - - if (!obj.empty() && obj[0] == '/') - { - obj.erase(obj.begin()); - } + // use a different prefix, do not take namespace from object path + ret = YAST_POLKIT_PREFIX_MANAGER; + // Lock and Unlock methods share the same PolicyKit action Id "lock" + if (method == YAST_DBUS_MANAGER_UNLOCK_METHOD) + method = YAST_DBUS_MANAGER_LOCK_METHOD; + } + else + { + ret = YAST_POLKIT_PREFIX_MODULES; + std::string obj(msg.path()); + // convert object path "/org/opensuse/yast/Label" to PolKit path "Label" if (!obj.empty()) { - ret += '.' + obj; + if (obj[obj.size() - 1] == '/') + { + obj.erase(obj.size() - 1); + } + + obj.erase(0, obj.rfind("/")); + + if (!obj.empty() && obj[0] == '/') + { + obj.erase(obj.begin()); + } + + if (!obj.empty()) + { + ret += '.' + obj; + } } } - // Lock and Unlock methods share the same PolicyKit action Id "lock" - std::string method(msg.interface() == YAST_DBUS_MGR_INTERFACE && - msg.method() == YAST_DBUS_MANAGER_UNLOCK_METHOD ? YAST_DBUS_MANAGER_LOCK_METHOD : msg.method()); - ret += '.' + method; // make it valid action ID (lowercase chars, replace invalid chars) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org