summaryrefslogtreecommitdiffstats
path: root/src/input/allowLocalOrPrivileged.cpp
diff options
context:
space:
mode:
authorSebastien Braun2010-10-07 22:54:10 +0200
committerSebastien Braun2010-10-07 22:54:10 +0200
commite61097b8881bc7e72a5499816cb1199ea274a3ca (patch)
treebcfa9f3fe3f43af02845bc21367de395b248600c /src/input/allowLocalOrPrivileged.cpp
parentMake behaviour on lookup failures configurable (diff)
downloadpvs-e61097b8881bc7e72a5499816cb1199ea274a3ca.tar.gz
pvs-e61097b8881bc7e72a5499816cb1199ea274a3ca.tar.xz
pvs-e61097b8881bc7e72a5499816cb1199ea274a3ca.zip
Rework template meta-magic
- No more implicit dependency on Boost.MPL - Better documentation for template magic - Move input handler policies to handler definitions where they belong - Separate out event descriptions from handlers
Diffstat (limited to 'src/input/allowLocalOrPrivileged.cpp')
-rw-r--r--src/input/allowLocalOrPrivileged.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/input/allowLocalOrPrivileged.cpp b/src/input/allowLocalOrPrivileged.cpp
new file mode 100644
index 0000000..ba456dc
--- /dev/null
+++ b/src/input/allowLocalOrPrivileged.cpp
@@ -0,0 +1,21 @@
+/*
+ * inputHandlerSecurityPolicies.cpp
+ *
+ * Created on: Oct 7, 2010
+ * Author: brs
+ */
+
+#include "inputEventHandler.h"
+#include "pvsCheckPrivileges.h"
+
+bool input_policy::AllowLocalOrPrivileged::allow(InputEventContext const* ctx)
+{
+ if(ctx)
+ {
+ if(PVSCheckPrivileges::instance()->require(PVSCheckPrivileges::SESSION_LOCAL, ctx))
+ return true;
+ if(PVSCheckPrivileges::instance()->require(PVSCheckPrivileges::USER_PRIVILEGED, ctx))
+ return true;
+ }
+ return false;
+}