051c0af82a2dc040acde171e89691d9f64784cf8
[platform/core/appfw/app-installers.git] / src / common / utils / user_util.h
1 // Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMMON_UTILS_USER_UTIL_H_
6 #define COMMON_UTILS_USER_UTIL_H_
7
8 #include <boost/filesystem/path.hpp>
9 #include <boost/optional.hpp>
10
11 #include <sys/types.h>
12
13 #include <vector>
14 #include <string>
15 #include <tuple>
16
17 namespace bf = boost::filesystem;
18
19 namespace common_installer {
20
21 typedef std::vector<std::tuple<uid_t, gid_t, bf::path>> UserList;
22
23 UserList GetUserList();
24 boost::optional<bool> IsAdminUser(uid_t uid);
25 boost::optional<gid_t> GetGidByUid(uid_t uid);
26 std::string GetGroupNameByGid(gid_t gid);
27 std::string GetUsernameByUid(uid_t user);
28 boost::optional<uid_t> GetUidByUserName(const char* username);
29 boost::optional<gid_t> GetGidByGroupName(const char* groupname);
30
31
32 }  // namespace common_installer
33
34 #endif  // COMMON_UTILS_USER_UTIL_H_