2 * Copyright (c) 2014-2017 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 #include <security-manager-types.h>
24 #include <dpl/test/test_runner.h>
34 Privilege(std::string systemPrivilege, Type type = UNSET, std::string license = std::string())
35 : m_name(std::move(systemPrivilege))
37 , m_license(std::move(license))
40 Privilege(std::string licensedPrivilege, std::string license)
41 : m_name(std::move(licensedPrivilege))
43 , m_license(std::move(license))
46 bool isUnset() const { return m_type == UNSET; }
47 bool isUntrusted() const { return m_type == UNTRUSTED; }
48 bool isLicensed() const { return m_type == LICENSED; }
50 int getType() const { return m_type; }
51 app_defined_privilege_type getSMType () const {
52 RUNNER_ASSERT(m_type != UNSET);
53 if (isLicensed()) return SM_APP_DEFINED_PRIVILEGE_TYPE_LICENSED;
54 return SM_APP_DEFINED_PRIVILEGE_TYPE_UNTRUSTED;
57 const std::string& getName() const { return m_name; }
58 const std::string& getLicense() const { return m_license; }
60 const char *getNameC() const { return m_name.c_str(); }
61 const char *getLicenseC() const { return m_license.c_str(); }
63 operator const char *() const { return m_name.c_str(); }
65 operator std::string() const { return m_name; }
70 std::string m_license;
73 typedef std::vector<Privilege> PrivilegeVector;