add observers for essential action
authorYoungjae Shin <yj99.shin@samsung.com>
Wed, 15 Jan 2020 07:34:56 +0000 (16:34 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Wed, 18 Mar 2020 08:53:50 +0000 (17:53 +0900)
20 files changed:
schema/tizen_mode.xsd
supervisor/Action.cpp
supervisor/Action.h
supervisor/ActionObserver.h [new file with mode: 0644]
supervisor/ClientConnection.cpp
supervisor/ClientConnection.h
supervisor/Mode.cpp
supervisor/Mode.h
supervisor/ModeCareTaker.cpp
supervisor/ModeCareTaker.h
supervisor/ModeManager.cpp
supervisor/ModeManager.h
supervisor/ModeObserver.h [new file with mode: 0644]
supervisor/ModeXMLParser.cpp
supervisor/ModesXMLTag.cpp
supervisor/ModesXMLTag.h
supervisor/RequestHandler.cpp
supervisor/Supervisor.cpp
supervisor/TAction.h
supervisor/XMLGenerator.cpp

index 4a8ecb37a115216a93b22da5ab1c64a04446397b..9f48f1f370885fd6001da56ca498284e62f4a709 100644 (file)
@@ -30,6 +30,7 @@
             <xs:restriction base="xs:string">
               <xs:enumeration value="none"/>
               <xs:enumeration value="lock"/>
+              <xs:enumeration value="essential"/>
             </xs:restriction>
           </xs:simpleType>
         </xs:attribute>
index ee7a328ddc9acf0907347036a4227b5edf3ea560..c6224bc5f47b01152f0d6cfa1e03155383085c39 100644 (file)
 MODES_NAMESPACE_USE;
 
 Action::Action()
-       : isChanged(false), type(SYNC), plugin(nullptr), piAction(nullptr), stopOnErr(false), restriction(REQ_NONE), locked(false)
+       : isChanged(false), type(SYNC), plugin(nullptr), piAction(nullptr), stopOnErr(false), restriction(NONE), locked(false)
 
 {
 }
 
 Action::Action(const std::string &name)
-       : ruleName(name), isChanged(false), type(SYNC), plugin(nullptr), piAction(nullptr), stopOnErr(false), restriction(REQ_NONE), locked(false)
+       : ruleName(name), isChanged(false), type(SYNC), plugin(nullptr), piAction(nullptr), stopOnErr(false), restriction(NONE), locked(false)
 {
 }
 
@@ -117,12 +117,31 @@ std::string Action::getPrivilege()
        return privilege;
 }
 
+void Action::attachObserver(ActionObserver *obs)
+{
+       observers.push_back(obs);
+}
+
+void Action::detachObserver(ActionObserver *obs)
+{
+       observers.remove(obs);
+}
+
+void Action::notifyObservers()
+{
+       piAction->unSetChangedCallback(valueChangedCallback, this);
+       isChanged = true;
+
+       for (auto it = observers.begin(); it != observers.end(); ++it)
+               (*it)->update(ruleName);
+}
+
 void Action::valueChangedCallback(void *userData)
 {
        Action *action = (Action*)userData;
        RET_IF(NULL == action);
 
-       action->isChanged = true;
-       action->piAction->unSetChangedCallback(valueChangedCallback, userData);
+       action->notifyObservers();
+
        DBG("Action(%s) Changed", action->ruleName.c_str());
 }
index be089f84e277012e1610a698f148c210944aa9dd..e39bfe15ff09b156d68dd2a2b202882955b58902 100644 (file)
  */
 #pragma once
 
+#include <list>
 #include <string>
 #include "mdss.h"
 #include "Plugin.h"
 #include "PluginAction.h"
+#include "ActionObserver.h"
 
 MODES_NAMESPACE_BEGIN
 
 class Action {
 public:
        typedef enum {
-               REQ_NONE,
-               REQ_LOCK
+               NONE,
+               LOCK,
+               ESSENTIAL
        } ActionRestrict;
 
        typedef enum {
@@ -54,6 +57,8 @@ public:
        void setPlugin(Plugin *pi);
        void setPrivilege(const std::string &val);
        std::string getPrivilege();
+       void attachObserver(ActionObserver *obs);
+       void detachObserver(ActionObserver *obs);
        virtual int setValue(const std::string &val) = 0;
        virtual std::string getStringOfValue() = 0;
        virtual int apply() = 0;
@@ -69,11 +74,13 @@ protected:
        Plugin *plugin;
        PluginAction *piAction;
 private:
+       void notifyObservers();
        std::string id;
        std::string privilege;
        bool stopOnErr;
        ActionRestrict restriction;
        bool locked;
+       std::list<ActionObserver*> observers;
 };
 
 MODES_NAMESPACE_END
diff --git a/supervisor/ActionObserver.h b/supervisor/ActionObserver.h
new file mode 100644 (file)
index 0000000..2e2a3d5
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <string>
+#include "mdss.h"
+
+MODES_NAMESPACE_BEGIN
+
+class ActionObserver {
+public:
+       virtual void update(const std::string &rule) = 0;
+};
+
+MODES_NAMESPACE_END
index df206cbe571bbd3bb2e24b8271054066132bf6ad..5d34a52b9876dd079219d1c9f2851dfd4c6fe672 100644 (file)
 MODES_NAMESPACE_USE;
 
 guint ClientConnection::ownerId = 0;
-mdsDbus* ClientConnection::dbusHandle = NULL;
-
-void ClientConnection::addRequestHandler(const std::string &method, GCallback cb)
-{
-       g_signal_connect(dbusHandle, method.c_str(), cb, NULL);
-}
-
-void ClientConnection::onBusAcquired(GDBusConnection *conn, const gchar *name, gpointer userData)
-{
-       GError *error = NULL;
-
-       g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(dbusHandle),
-               conn, MODES_DBUS_OBJPATH, &error);
-       if (error) {
-               ERR("g_dbus_interface_skeleton_export() Fail(%s)", error->message);
-               g_error_free(error);
-       }
-}
+mdsDbus *ClientConnection::dbusHandle = NULL;
 
 void ClientConnection::startDbus()
 {
@@ -68,3 +51,25 @@ void ClientConnection::stopDbus()
        dbusHandle = NULL;
        ownerId = 0;
 }
+
+void ClientConnection::addRequestHandler(const std::string &method, GCallback cb)
+{
+       g_signal_connect(dbusHandle, method.c_str(), cb, NULL);
+}
+
+void ClientConnection::update(const std::string &name, ModeState state)
+{
+       mds_dbus_emit_changed_mode(dbusHandle, name.c_str(), state);
+}
+
+void ClientConnection::onBusAcquired(GDBusConnection *conn, const gchar *name, gpointer userData)
+{
+       GError *error = NULL;
+
+       g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(dbusHandle),
+               conn, MODES_DBUS_OBJPATH, &error);
+       if (error) {
+               ERR("g_dbus_interface_skeleton_export() Fail(%s)", error->message);
+               g_error_free(error);
+       }
+}
index fb0de0013a8218fd634f35bab99a9243232afd0a..02c5838d8d08adcab1297f1b80ab6ddc6c990563 100644 (file)
 #include <string>
 #include "common/dbus.h"
 #include "mdss.h"
+#include "ModeObserver.h"
 
 MODES_NAMESPACE_BEGIN
 
-class ClientConnection {
+class ClientConnection : public ModeObserver {
 public:
        void startDbus();
        void stopDbus();
        void addRequestHandler(const std::string &method, GCallback cb);
+       void update(const std::string &name, ModeState state);
 private:
        static void onBusAcquired(GDBusConnection *conn,
                        const gchar *name, gpointer user_data);
index 21c41a0e98be9c914c82ae6aa23c98e910d8cf41..039788a0d107448d225ddba49c1df39a19ccd245 100644 (file)
@@ -22,7 +22,7 @@
 MODES_NAMESPACE_USE;
 
 Mode::Mode()
-       : type(MODE_NORMAL), hidden(false)
+       : type(MODE_NORMAL), hidden(false), essential(false)
 {
 }
 
@@ -70,6 +70,16 @@ bool Mode::isHidden() const
        return hidden;
 }
 
+void Mode::setEssential(bool val)
+{
+       essential = val;
+}
+
+bool Mode::hasEssential() const
+{
+       return essential;
+}
+
 int Mode::apply()
 {
        std::list<std::shared_ptr<Action>>::iterator it;
index cf0a1ef76bdeb142328561d1e3e9f168475f1b24..60f9d1a5312b573af4e2f237d0eb5a574c34f990 100644 (file)
@@ -42,6 +42,9 @@ public:
        void setHidden(bool val);
        bool isHidden() const;
 
+       void setEssential(bool val);
+       bool hasEssential() const;
+
        void addAction(Action *action);
        std::list<std::shared_ptr<Action>> getActionList() const;
 
@@ -55,6 +58,7 @@ private:
        std::string name;
        ModeType type;
        bool hidden;
+       bool essential;
        std::list<std::shared_ptr<Action>> actionList;
        std::list<std::shared_ptr<Action>> undoList;
 #ifdef MDS_TEST
index ce836b782e218560a4f068527998bbef621dcb50..01ceee5193b161d31dbb3767aef5b002f4f8d2fd 100644 (file)
@@ -91,7 +91,7 @@ bool ModeCareTaker::findLockedAction(const std::string &ruleName)
 
                for (auto actionIt = actionList.begin(); actionIt != actionList.end(); actionIt++)
                        if ((*actionIt)->getRuleName() == ruleName
-                                       && (*actionIt)->getRestrict() == Action::REQ_LOCK) {
+                                       && (*actionIt)->getRestrict() == Action::LOCK) {
                                ERR("%s is restricted", ruleName.c_str());
                                return true;
                        }
index 8601eb7b2acdbe16ed80aedf6e04422fc09aa149..1510152763f822ab0408437a3987a33a868053fd 100644 (file)
@@ -35,6 +35,7 @@ public:
        bool isExclusive();
        bool checkConflictAction(const Mode &mode);
 private:
+       void handleEssentialAction();
        bool findLockedAction(const std::string &ruleName);
        std::map<std::string, Mode> savedModes;
        std::string undoDir;
index 7609eb4317e40fb6ee54093c280e54adc7366954..d2c185ecdad246f561b43a2f94f51c018aeab5ce 100644 (file)
 #include <exception>
 #include "mdss.h"
 #include "ModesEx.h"
+#include "ModeObserver.h"
+#include "XMLGenerator.h"
 #include "ModeXMLParser.h"
 #include "UndoInfoParser.h"
-#include "XMLGenerator.h"
 #include "ConflictManager.h"
 
 using std::string;
@@ -48,6 +49,7 @@ void ModeManager::setOptions(const std::set<string> &modeDirs, const string &xsd
 void ModeManager::init()
 {
        modeMap.clear();
+       essentialMap.clear();
 
        for (auto it = modeDirList.begin(); it != modeDirList.end(); ++it) {
                makeModeMap(*it);
@@ -78,6 +80,19 @@ void ModeManager::addModeAttributes(ModeParser *parser, const string &path)
        DBG("[%d] modeName : %s, modePath : %s, hidden : %s", modeMap.size(), modeName.c_str(), path.c_str(), hidden? "true": "false");
 }
 
+bool ModeManager::handleEssentialAction(const Mode &mode)
+{
+       bool stopOnErr = false;
+       std::list<std::shared_ptr<Action>> actionList = mode.getActionList();
+       for (auto it = actionList.begin(); it != actionList.end(); it++) {
+               if ((*it)->getRestrict() == Action::ESSENTIAL) {
+                       essentialMap.insert(std::make_pair(mode.getName(), (*it)->getRuleName()));
+                       (*it)->attachObserver(this);
+               }
+       }
+       return stopOnErr;
+}
+
 int ModeManager::applyMode(const string &modeName, ClientPrivilege &priv, bool isTest)
 {
        auto found = modeMap.find(modeName);
@@ -125,12 +140,15 @@ int ModeManager::applyMode(const string &modeName, ClientPrivilege &priv, bool i
                                return ret;
                        }
                        careTaker.pushMode(mode);
+                       if (mode.hasEssential())
+                               handleEssentialAction(mode);
                }
        } catch (ModesEx &e) {
                //Ususally, it is reached by Invalid Mode File
                ERR("apply Fail(%s)", e.what());
                return MODES_ERROR_NO_DATA;
        }
+       notifyObservers(modeName, ModeObserver::ON);
        return MODES_ERROR_NONE;
 }
 
@@ -162,6 +180,13 @@ int ModeManager::undoMode(const string &modeName)
                return ret;
        }
        mode.undo();
+       for (auto it = essentialMap.begin(); it != essentialMap.end(); ) {
+               if (it->second == modeName)
+                       it = essentialMap.erase(it);
+               else
+                       ++it;
+       }
+       notifyObservers(modeName, ModeObserver::OFF);
 
        return MODES_ERROR_NONE;
 }
@@ -181,6 +206,33 @@ std::list<std::tuple<string, int>> ModeManager::getModes()
        return modeList;
 }
 
+void ModeManager::attachObserver(ModeObserver *obs)
+{
+       observers.push_back(obs);
+}
+
+void ModeManager::detachObserver(ModeObserver *obs)
+{
+       observers.remove(obs);
+}
+
+void ModeManager::notifyObservers(const string &modeName, ModeObserver::ModeState state)
+{
+       for (auto it = observers.begin(); it != observers.end(); ++it)
+               (*it)->update(modeName, state);
+}
+
+void ModeManager::update(const std::string &rule)
+{
+       auto found = essentialMap.find(rule);
+       if (essentialMap.end() == found) {
+               ERR("No Mode related with essential rule(%s)", rule.c_str());
+               throw ModesEx(ModesEx::NO_DATA);
+       }
+
+       undoMode(found->second);
+}
+
 bool ModeManager::makeModeMap(const string &dirPath)
 {
        DBG("dirPath : [%s]", dirPath.c_str());
@@ -274,3 +326,4 @@ void ModeManager::addModeDirectory(const string &dirPath)
 
        modeDirList.insert(dirPath);
 }
+
index 7e31def3ab291ad8b84369d1232331194ce08d05..29971d70fbcdd6d32dc8ed887a3e7ee9cc8c6478 100644 (file)
 #include "ModeParser.h"
 #include "RuleManager.h"
 #include "ModeCareTaker.h"
+#include "ModeObserver.h"
+#include "ActionObserver.h"
 #include "ClientPrivilege.h"
 
+
 #ifndef MODES_MODE_DEFAULT_DIR
 #define MODES_MODE_DEFAULT_DIR "/usr/share/modes/mode"
 #warning "MODES_MODE_DEFAULT_DIR is redefined"
@@ -31,7 +34,7 @@
 
 MODES_NAMESPACE_BEGIN
 
-class ModeManager {
+class ModeManager : public ActionObserver {
 public:
        ModeManager(RuleManager &rMgr);
 
@@ -42,19 +45,25 @@ public:
        int registerMode(const Mode &mode);
        int undoMode(const std::string &modeName);
        std::list<std::tuple<std::string, int>> getModes();
+       void attachObserver(ModeObserver *obs);
+       void detachObserver(ModeObserver *obs);
+       void update(const std::string &rule);
 private:
+       bool handleEssentialAction(const Mode &mode);
+       void notifyObservers(const std::string &modeName, ModeObserver::ModeState state);
        bool makeModeMap(const std::string &dirPath);
        bool restoreUndoInfo(const std::string &dirPath);
        void addModeAttributes(ModeParser *parser, const std::string &path);
        ModeParser* getModeParser(const std::string &path);
 
        std::map<std::string, std::pair<std::string, bool>> modeMap;
+       std::map<std::string, std::string> essentialMap;
        std::set<std::string> modeDirList;
        std::string undoDir;
        std::string modeSyntaxFile;
        RuleManager &ruleMgr;
        ModeCareTaker careTaker;
-
+       std::list<ModeObserver*> observers;
 #ifdef MDS_TEST
        friend class ModeManagerTest;
        friend class ConflictTest;
diff --git a/supervisor/ModeObserver.h b/supervisor/ModeObserver.h
new file mode 100644 (file)
index 0000000..2ff980a
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2019-2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <string>
+#include "mdss.h"
+
+MODES_NAMESPACE_BEGIN
+
+class ModeObserver {
+public:
+       typedef enum {
+               OFF = 0,
+               ON = 1
+       } ModeState;
+       virtual void update(const std::string &mode, ModeState state) = 0;
+};
+
+MODES_NAMESPACE_END
index 5707d502d0932fc35f5b24a92fcd2a03a2db1acf..b6d691b9c2e26d66ef9e9c432722b46cdbe7860b 100644 (file)
@@ -149,12 +149,18 @@ void ModeXMLParser::parseUndo(xmlNodePtr node)
 
 void ModeXMLParser::parseActionAttr(xmlNodePtr node, Action *action)
 {
-       char *restictProp = (char*)xmlGetProp(node, ModesXMLTag::RESTICT);
-       if (restictProp && MDS_EQUAL == strcmp(restictProp, ModesXMLTag::RESTICT_LOCK))
-               action->setRestrict(Action::REQ_LOCK);
-       else
-               action->setRestrict(Action::REQ_NONE);
-       xmlFree(restictProp);
+       char *restictProp = (char*)xmlGetProp(node, ModesXMLTag::RESTRICT);
+       action->setRestrict(Action::NONE);
+       if (restictProp) {
+               if (MDS_EQUAL == strcmp(restictProp, ModesXMLTag::RESTRICT_LOCK)) {
+                       action->setRestrict(Action::LOCK);
+               } else if (MDS_EQUAL == strcmp(restictProp, ModesXMLTag::RESTRICT_ESSENTIAL)) {
+                       action->setRestrict(Action::ESSENTIAL);
+                       mode.setEssential(true);
+               }
+
+               xmlFree(restictProp);
+       }
 
        char *stopOnErrProp = (char*)xmlGetProp(node, ModesXMLTag::STOP_ON_ERR);
        if (stopOnErrProp && MDS_EQUAL == strcmp(stopOnErrProp, "true"))
index e50df6ae76e37b85886c463ee1b77468f10406c7..ab45a09e8cdc183ae0eb9cb191cecb939f89b7d6 100644 (file)
@@ -36,8 +36,9 @@ const xmlChar* const ModesXMLTag::ACTION = (xmlChar*)"action";
 const xmlChar* const ModesXMLTag::UNDO = (xmlChar*)"undo";
 const xmlChar* const ModesXMLTag::RULE = (xmlChar*)"rule";
 const xmlChar* const ModesXMLTag::STOP_ON_ERR = (xmlChar*)"stopOnErr";
-const xmlChar* const ModesXMLTag::RESTICT = (xmlChar*)"restrict";
-const char* const ModesXMLTag::RESTICT_LOCK = "lock";
+const xmlChar* const ModesXMLTag::RESTRICT = (xmlChar*)"restrict";
+const char* const ModesXMLTag::RESTRICT_LOCK = "lock";
+const char* const ModesXMLTag::RESTRICT_ESSENTIAL = "essential";
 const xmlChar* const ModesXMLTag::ID = (xmlChar*)"ID";
 //UndoInfo
 const xmlChar* const ModesXMLTag::UNDO_INFO = (xmlChar*)"UndoInfo";
index 24db801730a2d34df510dc21e75617f043172604..ee20114c82a09a253da9a046e81b9729312e1304 100644 (file)
@@ -39,8 +39,9 @@ struct ModesXMLTag {
        static const xmlChar* const UNDO;
        static const xmlChar* const RULE;
        static const xmlChar* const STOP_ON_ERR;
-       static const xmlChar* const RESTICT;
-       static const char* const RESTICT_LOCK;
+       static const xmlChar* const RESTRICT;
+       static const char* const RESTRICT_LOCK;
+       static const char* const RESTRICT_ESSENTIAL;
        static const xmlChar* const ID;
        //UndoInfo
        static const xmlChar* const UNDO_INFO;
index 9143210ff111fc62789c274eee55ec747c8cb714..23b0efeeaf42a85fce98b1ea167488410f2c15bc 100644 (file)
@@ -21,7 +21,7 @@
 
 MODES_NAMESPACE_USE;
 
-ModeManagerRequestHandler::modeMgr = NULL;
+ModeManager *RequestHandler::modeMgr = NULL;
 RuleManager *RequestHandler::ruleMgr = NULL;
 
 void RequestHandler::setModeManager(ModeManager *mgr)
@@ -61,8 +61,6 @@ gboolean RequestHandler::applyModeHandler(mdsDbus *object, GDBusMethodInvocation
        int ret = modeMgr->applyMode(modeName, privInfo, false);
 
        mds_dbus_complete_apply_mode(object, invocation, ret);
-       if (MODES_ERROR_NONE == ret)
-               mds_dbus_emit_changed_mode(object, modeName, 1);
 
        return TRUE;
 }
@@ -78,8 +76,6 @@ gboolean RequestHandler::undoModeHandler(mdsDbus *object, GDBusMethodInvocation
        int ret = modeMgr->undoMode(modeName);
 
        mds_dbus_complete_undo_mode(object, invocation, ret);
-       if (MODES_ERROR_NONE == ret)
-               mds_dbus_emit_changed_mode(object, modeName, 0);
 
        return TRUE;
 }
@@ -195,7 +191,7 @@ Action* RequestHandler::createAction(char *id, char *ruleName, char *val)
 
        if (id)
                action->setID(id);
-       action->setRestrict(Action::REQ_NONE); //It is not allowed to set Restrict of Action by API.
+       action->setRestrict(Action::NONE); //It is not allowed to set Restrict of Action by API.
        action->setValue(val);
 
        action->printInfo();
index 3598a7a41d2d01147d0afa83525f3c7d549da7f6..90366e15cd8246a1033a1252a33aa0fd075311a1 100644 (file)
@@ -37,6 +37,7 @@ void Supervisor::init()
                clientConn.startDbus();
                ruleMgr.start();
                modeMgr.init();
+               modeMgr.attachObserver(&clientConn);
        }
        catch (ModesEx &e) {
                ERR("Supervisor init() Fail(%s)", e.what());
@@ -45,6 +46,7 @@ void Supervisor::init()
 
 void Supervisor::deInit()
 {
+       modeMgr.detachObserver(&clientConn);
        ruleMgr.stop();
        clientConn.stopDbus();
        RequestHandler::setModeManager(NULL);
index 26baf341970b4ad4ac3495ee2405582c31697c01..bb07e16e717a5ffc47ce357daa30811bb8d695a6 100644 (file)
@@ -85,14 +85,13 @@ public:
                RETVM_IF(NULL == plugin, MODES_ERROR_NO_DATA, "Action(%s) : No plugin", ruleName.c_str());
 
                int pos = ruleName.find_first_of(".");
-               PluginAction *tmpAction = plugin->getUndoAction(ruleName.substr(pos + 1), info);
-               if (nullptr == tmpAction) {
+               piAction = plugin->getUndoAction(ruleName.substr(pos + 1), info);
+               if (nullptr == piAction) {
                        ERR("plugin(%s) getUndoAction() Fail", plugin->getName().c_str());
                        return MODES_ERROR_NOT_SUPPORTED;
                }
-               tmpAction->setChangedCallback(valueChangedCallback, this);
+               piAction->setChangedCallback(valueChangedCallback, this);
 
-               piAction = tmpAction;
                return MODES_ERROR_NONE;
        }
 
index 9f671e8aefd8dda1bc907bf9f693f731eeb45427..a99d27f978ec68e83814d44354f620e64d87dcd0 100644 (file)
@@ -100,8 +100,8 @@ void XMLGenerator::makeModeXML(const std::string &filename, const Mode &mode)
 
                xmlSetProp(actionNode, ModesXMLTag::RULE, (xmlChar*)(*it)->getRuleName().c_str());
 
-               if (restriction == Action::ActionRestrict::REQ_LOCK)
-                       xmlSetProp(actionNode, ModesXMLTag::RESTICT, (xmlChar*)ModesXMLTag::RESTICT_LOCK);
+               if (restriction == Action::ActionRestrict::LOCK)
+                       xmlSetProp(actionNode, ModesXMLTag::RESTRICT, (xmlChar*)ModesXMLTag::RESTRICT_LOCK);
 
                xmlNodeSetContent(actionNode, (xmlChar*)(*it)->getStringOfValue().c_str());