2 * Copyright (c) 2014-2018 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>
35 Privilege(std::string systemPrivilege, Type type = UNSET, std::string license = std::string())
36 : m_name(std::move(systemPrivilege))
38 , m_license(std::move(license))
41 Privilege(std::string licensedPrivilege, std::string license)
42 : m_name(std::move(licensedPrivilege))
44 , m_license(std::move(license))
47 bool isUnset() const { return m_type == UNSET; }
48 bool isUntrusted() const { return m_type == UNTRUSTED; }
49 bool isLicensed() const { return m_type == LICENSED; }
50 bool isPrivacy() const { return m_type == PRIVACY; }
52 int getType() const { return m_type; }
53 app_defined_privilege_type getSMType () const {
54 RUNNER_ASSERT(m_type != UNSET);
55 if (isLicensed()) return SM_APP_DEFINED_PRIVILEGE_TYPE_LICENSED;
56 return SM_APP_DEFINED_PRIVILEGE_TYPE_UNTRUSTED;
59 const std::string& getName() const { return m_name; }
60 const std::string& getLicense() const { return m_license; }
62 const char *getNameC() const { return m_name.c_str(); }
63 const char *getLicenseC() const { return m_license.c_str(); }
65 operator const char *() const { return m_name.c_str(); }
67 operator std::string() const { return m_name; }
72 std::string m_license;
75 typedef std::vector<Privilege> PrivilegeVector;