2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Rafal Krypa <r.krypa@samsung.com>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
19 * @file service_impl.h
20 * @author Rafal Krypa <r.krypa@samsung.com>
21 * @brief Implementation of the service methods
24 #ifndef _SECURITY_MANAGER_SERVICE_IMPL_
25 #define _SECURITY_MANAGER_SERVICE_IMPL_
28 #include <sys/types.h>
30 #include <unordered_set>
32 #include "security-manager.h"
34 namespace SecurityManager {
35 namespace ServiceImpl {
38 * Process application installation request.
40 * @param[in] req installation request
41 * @param[in] uid id of the requesting user
43 * @return API return code, as defined in protocols.h
45 int appInstall(const app_inst_req &req, uid_t uid);
48 * Process application uninstallation request.
50 * @param[in] req uninstallation request
51 * @param[in] uid id of the requesting user
53 * @return API return code, as defined in protocols.h
55 int appUninstall(const std::string &appId, uid_t uid);
58 * Process package id query.
59 * Retrieves the package id associated with given application id.
61 * @param[in] appId application identifier
62 * @param[out] pkgId returned package identifier
64 * @return API return code, as defined in protocols.h
66 int getPkgId(const std::string &appId, std::string &pkgId);
69 * Process query for supplementary groups allowed for the application.
70 * For given appId and uid, calculate allowed privileges that give
71 * direct access to file system resources. For each permission Cynara will be
73 * Returns set of group ids that are permitted.
75 * @param[in] appId application identifier
76 * @param[in] uid id of the requesting user
77 * @param[in] pid id of the requesting process (to construct Cynara session id)
78 * @param[out] gids returned set of allowed group ids
80 * @return API return code, as defined in protocols.h
82 int getAppGroups(const std::string &appId, uid_t uid, pid_t pid, std::unordered_set<gid_t> &gids);
85 * Process user adding request.
87 * @param[in] uidAdded uid of newly created user
88 * @param[in] userType type of newly created user
89 * @param[in] uid uid of requesting user
91 * @return API return code, as defined in protocols.h
93 int userAdd(uid_t uidAdded, int userType, uid_t uid);
96 * Process user deletion request.
98 * @param[in] uidDeleted uid of removed user
99 * @param[in] uid uid of requesting user
101 * @return API return code, as defined in protocols.h
103 int userDelete(uid_t uidDeleted, uid_t uid);
106 * Update policy in Cynara - proper privilege: http://tizen.org/privilege/systemsettings.admin
107 * is needed for this to succeed
109 * @param[in] policyEntries vector of policy chunks with instructions
110 * @param[in] uid identifier of requesting user
111 * @param[in] pid PID of requesting process
112 * @param[in] smackLabel smack label of requesting app
114 * @return API return code, as defined in protocols.h
116 int policyUpdate(const std::vector<policy_entry> &policyEntries, uid_t uid, pid_t pid, const std::string &smackLabel);
117 } /* namespace ServiceImpl */
118 } /* namespace SecurityManager */
120 #endif /* _SECURITY_MANAGER_SERVICE_IMPL_ */