/*
- * Copyright (c) 2014 Samsung Electronics Co.
+ * Copyright (c) 2014-2015 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <attributes/attributes.h>
#include <log/log.h>
+#include <types/PolicyDescription.h>
#include <types/SupportedTypes.h>
using namespace Cynara;
namespace AskUser {
-const std::vector<PolicyType> clientTypes = {
- SupportedTypes::Client::ALLOW_ONCE,
- SupportedTypes::Client::ALLOW_PER_SESSION,
+const std::vector<PolicyDescription> clientDescriptions = {
+ { SupportedTypes::Client::ALLOW_ONCE, "Allow once" },
+ { SupportedTypes::Client::ALLOW_PER_SESSION, "Allow per session" },
- SupportedTypes::Client::DENY_ONCE,
- SupportedTypes::Client::DENY_PER_SESSION
+ { SupportedTypes::Client::DENY_ONCE, "Deny once" },
+ { SupportedTypes::Client::DENY_PER_SESSION, "Deny per session" }
};
class ClientPlugin : public ClientPluginInterface {
public:
- const std::vector<PolicyType> &getSupportedPolicyTypes() {
- return clientTypes;
+ const std::vector<PolicyDescription> &getSupportedPolicyDescr() {
+ return clientDescriptions;
}
bool isCacheable(const ClientSession &session UNUSED, const PolicyResult &result) {
/*
- * Copyright (c) 2014 Samsung Electronics Co.
+ * Copyright (c) 2014-2015 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <ostream>
#include <cynara-plugin.h>
+#include <types/PolicyDescription.h>
#include <types/SupportedTypes.h>
#include <translator/Translator.h>
std::to_string(privilege.size());
};
-const std::vector<PolicyType> serviceTypes = {SupportedTypes::Service::ASK_USER};
+const std::vector<PolicyDescription> serviceDescriptions = {
+ { SupportedTypes::Service::ASK_USER, "Ask user" }
+};
class AskUserPlugin : public ServicePluginInterface {
public:
AskUserPlugin()
: m_cache(hasher)
{}
- const std::vector<PolicyType> &getSupportedPolicyTypes() {
- return serviceTypes;
+ const std::vector<PolicyDescription> &getSupportedPolicyDescr() {
+ return serviceDescriptions;
}
+
PluginStatus check(const std::string &client,
const std::string &user,
const std::string &privilege,