Browse Source

[trac997] The ACL class implementation

Michal 'vorner' Vaner 14 years ago
parent
commit
46f82ccf0e
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/lib/acl/acl.h

+ 8 - 2
src/lib/acl/acl.h

@@ -96,7 +96,13 @@ public:
      *     passed to the checks.
      */
     Action execute(const Context& context) const {
-        // TODO a for cycle
+        for (typename Entries::const_iterator i(entries_.begin());
+             i != entries_.end(); ++ i) {
+            if (i->first->matches(context)) {
+                return (i->second);
+            }
+        }
+        return (policy_);
     }
     /**
      * \brief Add new entry at the end of the list.
@@ -109,7 +115,7 @@ public:
      * \param action The action to return when the thing matches this check.
      */
     void append(CheckPtr check, const Action& action) {
-
+        entries_.push_back(Entry(check, action));
     }
 private:
     // Just type abbreviations.