blob: 13f3c8ee485ef91666cdc8b801adeee341791931 [file] [log] [blame]
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +05301/*
2// Copyright (c) 2018 Intel Corporation
3//
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
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
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.
15*/
16#pragma once
Abhilash Raju93804eb2024-10-01 00:24:43 -050017#include "json_serializer.hpp"
Patrick Williams9638afb2021-02-22 17:16:24 -060018#include "users.hpp"
19
Nan Zhou49c81362022-10-25 00:07:08 +000020#include <boost/process/child.hpp>
21#include <boost/process/io.hpp>
22#include <phosphor-logging/elog-errors.hpp>
23#include <phosphor-logging/elog.hpp>
Jiaqing Zhao11ec6662022-07-05 20:55:34 +080024#include <phosphor-logging/lg2.hpp>
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +053025#include <sdbusplus/bus.hpp>
26#include <sdbusplus/server/object.hpp>
Nan Zhou49c81362022-10-25 00:07:08 +000027#include <xyz/openbmc_project/Common/error.hpp>
Richard Marian Thomaiyar9164fd92018-06-13 16:51:00 +053028#include <xyz/openbmc_project/User/AccountPolicy/server.hpp>
Patrick Williams9638afb2021-02-22 17:16:24 -060029#include <xyz/openbmc_project/User/Manager/server.hpp>
Abhilash Rajua1a754c2024-07-25 05:43:40 -050030#include <xyz/openbmc_project/User/MultiFactorAuthConfiguration/server.hpp>
31#include <xyz/openbmc_project/User/TOTPState/server.hpp>
Patrick Williams9638afb2021-02-22 17:16:24 -060032
Nan Zhoue47c09d2022-10-25 00:06:41 +000033#include <span>
34#include <string>
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +053035#include <unordered_map>
Ratan Guptaaeaf9412019-02-11 04:41:52 -060036#include <variant>
Nan Zhoue47c09d2022-10-25 00:06:41 +000037#include <vector>
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +053038
39namespace phosphor
40{
41namespace user
42{
43
Nan Zhou49c81362022-10-25 00:07:08 +000044inline constexpr size_t ipmiMaxUsers = 15;
45inline constexpr size_t maxSystemUsers = 30;
Nan Zhou4bc69812022-10-25 00:07:13 +000046inline constexpr uint8_t minPasswdLength = 8;
Chandramohan Harkude9ca86922025-05-18 13:09:25 +053047extern uint8_t maxPasswdLength; // MAX_PASSWORD_LENGTH;
Nan Zhouda401fe2022-10-25 00:07:18 +000048inline constexpr size_t maxSystemGroupNameLength = 32;
49inline constexpr size_t maxSystemGroupCount = 64;
Nan Zhou49c81362022-10-25 00:07:08 +000050
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +053051using UserMgrIface = sdbusplus::xyz::openbmc_project::User::server::Manager;
52using UserSSHLists =
53 std::pair<std::vector<std::string>, std::vector<std::string>>;
Richard Marian Thomaiyar9164fd92018-06-13 16:51:00 +053054using AccountPolicyIface =
55 sdbusplus::xyz::openbmc_project::User::server::AccountPolicy;
56
Abhilash Rajua1a754c2024-07-25 05:43:40 -050057using MultiFactorAuthConfigurationIface =
58 sdbusplus::xyz::openbmc_project::User::server::MultiFactorAuthConfiguration;
59
60using TOTPStateIface = sdbusplus::xyz::openbmc_project::User::server::TOTPState;
61
62using Ifaces = sdbusplus::server::object_t<UserMgrIface, AccountPolicyIface,
63 MultiFactorAuthConfigurationIface,
64 TOTPStateIface>;
Ratan Gupta1af12232018-11-03 00:35:38 +053065
Ratan Guptaaeaf9412019-02-11 04:41:52 -060066using Privilege = std::string;
67using GroupList = std::vector<std::string>;
68using UserEnabled = bool;
69using PropertyName = std::string;
Ravi Teja5fe724a2019-05-07 05:14:42 -050070using ServiceEnabled = bool;
Ratan Guptaaeaf9412019-02-11 04:41:52 -060071
72using UserInfo = std::variant<Privilege, GroupList, UserEnabled>;
73using UserInfoMap = std::map<PropertyName, UserInfo>;
74
75using DbusUserObjPath = sdbusplus::message::object_path;
76
Patrick Williamsfdf09372020-05-13 18:01:45 -050077using DbusUserPropVariant = std::variant<Privilege, ServiceEnabled>;
Ratan Guptaaeaf9412019-02-11 04:41:52 -060078
Alexander Filippov75626582022-02-09 18:42:37 +030079using DbusUserObjProperties = std::map<PropertyName, DbusUserPropVariant>;
Ratan Guptaaeaf9412019-02-11 04:41:52 -060080
81using Interface = std::string;
82
83using DbusUserObjValue = std::map<Interface, DbusUserObjProperties>;
84
85using DbusUserObj = std::map<DbusUserObjPath, DbusUserObjValue>;
86
Abhilash Rajua1a754c2024-07-25 05:43:40 -050087using MultiFactorAuthType = sdbusplus::common::xyz::openbmc_project::user::
88 MultiFactorAuthConfiguration::Type;
Nan Zhoue47c09d2022-10-25 00:06:41 +000089std::string getCSVFromVector(std::span<const std::string> vec);
90
Nan Zhou332fb9d2022-10-25 00:07:03 +000091bool removeStringFromCSV(std::string& csvStr, const std::string& delStr);
92
Nan Zhou8a11d992022-10-25 00:07:06 +000093template <typename... ArgTypes>
Nan Zhou49c81362022-10-25 00:07:08 +000094std::vector<std::string> executeCmd(const char* path, ArgTypes&&... tArgs)
95{
96 std::vector<std::string> stdOutput;
97 boost::process::ipstream stdOutStream;
98 boost::process::child execProg(path, const_cast<char*>(tArgs)...,
99 boost::process::std_out > stdOutStream);
100 std::string stdOutLine;
101
102 while (stdOutStream && std::getline(stdOutStream, stdOutLine) &&
103 !stdOutLine.empty())
104 {
105 stdOutput.emplace_back(stdOutLine);
106 }
107
108 execProg.wait();
109
110 int retCode = execProg.exit_code();
111 if (retCode)
112 {
Jiaqing Zhao11ec6662022-07-05 20:55:34 +0800113 lg2::error("Command {PATH} execution failed, return code {RETCODE}",
114 "PATH", path, "RETCODE", retCode);
Nan Zhou49c81362022-10-25 00:07:08 +0000115 phosphor::logging::elog<
116 sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure>();
117 }
118
119 return stdOutput;
120}
Nan Zhou8a11d992022-10-25 00:07:06 +0000121
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530122/** @class UserMgr
123 * @brief Responsible for managing user accounts over the D-Bus interface.
124 */
Ratan Gupta1af12232018-11-03 00:35:38 +0530125class UserMgr : public Ifaces
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530126{
127 public:
128 UserMgr() = delete;
129 ~UserMgr() = default;
Patrick Williams9638afb2021-02-22 17:16:24 -0600130 UserMgr(const UserMgr&) = delete;
131 UserMgr& operator=(const UserMgr&) = delete;
132 UserMgr(UserMgr&&) = delete;
133 UserMgr& operator=(UserMgr&&) = delete;
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530134
135 /** @brief Constructs UserMgr object.
136 *
137 * @param[in] bus - sdbusplus handler
138 * @param[in] path - D-Bus path
139 */
Patrick Williamsb3ef4e12022-07-22 19:26:55 -0500140 UserMgr(sdbusplus::bus_t& bus, const char* path);
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530141
142 /** @brief create user method.
143 * This method creates a new user as requested
144 *
145 * @param[in] userName - Name of the user which has to be created
146 * @param[in] groupNames - Group names list, to which user has to be added.
147 * @param[in] priv - Privilege of the user.
148 * @param[in] enabled - State of the user enabled / disabled.
149 */
150 void createUser(std::string userName, std::vector<std::string> groupNames,
151 std::string priv, bool enabled) override;
152
153 /** @brief rename user method.
154 * This method renames the user as requested
155 *
156 * @param[in] userName - current name of the user
157 * @param[in] newUserName - new user name to which it has to be renamed.
158 */
159 void renameUser(std::string userName, std::string newUserName) override;
160
161 /** @brief delete user method.
162 * This method deletes the user as requested
163 *
164 * @param[in] userName - Name of the user which has to be deleted
165 */
166 void deleteUser(std::string userName);
167
168 /** @brief Update user groups & privilege.
169 * This method updates user groups & privilege
170 *
171 * @param[in] userName - user name, for which update is requested
172 * @param[in] groupName - Group to be updated..
173 * @param[in] priv - Privilege to be updated.
174 */
Patrick Williams9638afb2021-02-22 17:16:24 -0600175 void updateGroupsAndPriv(const std::string& userName,
Nan Zhoufef63032022-10-25 00:07:12 +0000176 std::vector<std::string> groups,
Patrick Williams9638afb2021-02-22 17:16:24 -0600177 const std::string& priv);
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530178
179 /** @brief Update user enabled state.
180 * This method enables / disables user
181 *
182 * @param[in] userName - user name, for which update is requested
183 * @param[in] enabled - enable / disable the user
184 */
Patrick Williams9638afb2021-02-22 17:16:24 -0600185 void userEnable(const std::string& userName, bool enabled);
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530186
Denis Zlobine8edab52023-09-06 12:26:45 +0000187 /** @brief get user enabled state
188 * method to get user enabled state.
189 *
190 * @param[in] userName - name of the user
191 * @return - user enabled status (true/false)
192 */
193 virtual bool isUserEnabled(const std::string& userName);
194
Richard Marian Thomaiyar9164fd92018-06-13 16:51:00 +0530195 /** @brief update minimum password length requirement
196 *
197 * @param[in] val - minimum password length
198 * @return - minimum password length
199 */
200 uint8_t minPasswordLength(uint8_t val) override;
201
202 /** @brief update old password history count
203 *
204 * @param[in] val - number of times old passwords has to be avoided
205 * @return - number of times old password has to be avoided
206 */
207 uint8_t rememberOldPasswordTimes(uint8_t val) override;
208
209 /** @brief update maximum number of failed login attempt before locked
210 * out.
211 *
212 * @param[in] val - number of allowed attempt
213 * @return - number of allowed attempt
214 */
215 uint16_t maxLoginAttemptBeforeLockout(uint16_t val) override;
216
217 /** @brief update timeout to unlock the account
218 *
219 * @param[in] val - value in seconds
220 * @return - value in seconds
221 */
222 uint32_t accountUnlockTimeout(uint32_t val) override;
223
Jason M. Bills2d042d12023-03-28 15:32:45 -0700224 /** @brief parses the faillock output for locked user status
225 *
226 * @param[in] - output from faillock for the user
227 * @return - true / false indicating user locked / un-locked
228 **/
Patrick Williams88a82db2025-02-01 08:22:37 -0500229 bool parseFaillockForLockout(
230 const std::vector<std::string>& faillockOutput);
Jason M. Bills2d042d12023-03-28 15:32:45 -0700231
Richard Marian Thomaiyarc7045192018-06-13 16:51:00 +0530232 /** @brief lists user locked state for failed attempt
233 *
234 * @param[in] - user name
235 * @return - true / false indicating user locked / un-locked
236 **/
Patrick Williams9638afb2021-02-22 17:16:24 -0600237 virtual bool userLockedForFailedAttempt(const std::string& userName);
Richard Marian Thomaiyarc7045192018-06-13 16:51:00 +0530238
239 /** @brief lists user locked state for failed attempt
240 *
241 * @param[in]: user name
242 * @param[in]: value - false -unlock user account, true - no action taken
243 **/
Patrick Williams9638afb2021-02-22 17:16:24 -0600244 bool userLockedForFailedAttempt(const std::string& userName,
245 const bool& value);
Richard Marian Thomaiyarc7045192018-06-13 16:51:00 +0530246
Joseph Reynolds3ab6cc22020-03-03 14:09:03 -0600247 /** @brief shows if the user's password is expired
248 *
249 * @param[in]: user name
250 * @return - true / false indicating user password expired
251 **/
Patrick Williams9638afb2021-02-22 17:16:24 -0600252 virtual bool userPasswordExpired(const std::string& userName);
Joseph Reynolds3ab6cc22020-03-03 14:09:03 -0600253
Ratan Guptaaeaf9412019-02-11 04:41:52 -0600254 /** @brief returns user info
255 * Checks if user is local user, then returns map of properties of user.
256 * like user privilege, list of user groups, user enabled state and user
257 * locked state. If its not local user, then it checks if its a ldap user,
258 * then it gets the privilege mapping of the LDAP group.
259 *
260 * @param[in] - user name
261 * @return - map of user properties
262 **/
263 UserInfoMap getUserInfo(std::string userName) override;
264
Nan Zhou49c81362022-10-25 00:07:08 +0000265 /** @brief get IPMI user count
266 * method to get IPMI user count
267 *
268 * @return - returns user count
269 */
270 virtual size_t getIpmiUsersCount(void);
271
Nan Zhouda401fe2022-10-25 00:07:18 +0000272 void createGroup(std::string groupName) override;
273
274 void deleteGroup(std::string groupName) override;
Abhilash Rajua1a754c2024-07-25 05:43:40 -0500275 MultiFactorAuthType enabled() const override
276 {
277 return MultiFactorAuthConfigurationIface::enabled();
278 }
279 MultiFactorAuthType enabled(MultiFactorAuthType value,
280 bool skipSignal) override;
281 bool secretKeyRequired(std::string userName) override;
Nan Zhouda401fe2022-10-25 00:07:18 +0000282 static std::vector<std::string> readAllGroupsOnSystem();
Abhilash Raju93804eb2024-10-01 00:24:43 -0500283 void load();
284 JsonSerializer& getSerializer()
285 {
286 return serializer;
287 }
Nan Zhouda401fe2022-10-25 00:07:18 +0000288
Nan Zhoue48085d2022-10-25 00:07:04 +0000289 protected:
290 /** @brief get pam argument value
291 * method to get argument value from pam configuration
292 *
293 * @param[in] moduleName - name of the module from where arg has to be read
294 * @param[in] argName - argument name
295 * @param[out] argValue - argument value
296 *
297 * @return 0 - success state of the function
298 */
299 int getPamModuleArgValue(const std::string& moduleName,
300 const std::string& argName, std::string& argValue);
301
Jason M. Bills2d042d12023-03-28 15:32:45 -0700302 /** @brief get pam argument value
303 * method to get argument value from pam configuration
304 *
305 * @param[in] confFile - path of the module config file from where arg has
306 * to be read
307 * @param[in] argName - argument name
308 * @param[out] argValue - argument value
309 *
310 * @return 0 - success state of the function
311 */
312 int getPamModuleConfValue(const std::string& confFile,
313 const std::string& argName,
314 std::string& argValue);
315
Nan Zhoue48085d2022-10-25 00:07:04 +0000316 /** @brief set pam argument value
317 * method to set argument value in pam configuration
318 *
319 * @param[in] moduleName - name of the module in which argument value has
320 * to be set
321 * @param[in] argName - argument name
322 * @param[out] argValue - argument value
323 *
324 * @return 0 - success state of the function
325 */
326 int setPamModuleArgValue(const std::string& moduleName,
327 const std::string& argName,
328 const std::string& argValue);
329
Jason M. Bills2d042d12023-03-28 15:32:45 -0700330 /** @brief set pam argument value
331 * method to set argument value in pam configuration
332 *
333 * @param[in] confFile - path of the module config file in which argument
334 * value has to be set
335 * @param[in] argName - argument name
336 * @param[out] argValue - argument value
337 *
338 * @return 0 - success state of the function
339 */
340 int setPamModuleConfValue(const std::string& confFile,
341 const std::string& argName,
342 const std::string& argValue);
343
Nan Zhou8a11d992022-10-25 00:07:06 +0000344 /** @brief check for user presence
345 * method to check for user existence
346 *
347 * @param[in] userName - name of the user
348 * @return -true if user exists and false if not.
349 */
350 bool isUserExist(const std::string& userName);
351
Nan Zhou49c81362022-10-25 00:07:08 +0000352 size_t getNonIpmiUsersCount();
353
Nan Zhou8a11d992022-10-25 00:07:06 +0000354 /** @brief check user exists
355 * method to check whether user exist, and throw if not.
356 *
357 * @param[in] userName - name of the user
358 */
359 void throwForUserDoesNotExist(const std::string& userName);
360
361 /** @brief check user does not exist
362 * method to check whether does not exist, and throw if exists.
363 *
364 * @param[in] userName - name of the user
365 */
366 void throwForUserExists(const std::string& userName);
367
Nan Zhou40e44972022-10-25 00:07:07 +0000368 /** @brief check user name constraints
369 * method to check user name constraints and throw if failed.
370 *
371 * @param[in] userName - name of the user
372 * @param[in] groupNames - user groups
373 */
Patrick Williams88a82db2025-02-01 08:22:37 -0500374 void throwForUserNameConstraints(
375 const std::string& userName,
376 const std::vector<std::string>& groupNames);
Nan Zhou40e44972022-10-25 00:07:07 +0000377
Nan Zhou49c81362022-10-25 00:07:08 +0000378 /** @brief check group user count
379 * method to check max group user count, and throw if limit reached
380 *
381 * @param[in] groupNames - group name
382 */
383 void throwForMaxGrpUserCount(const std::vector<std::string>& groupNames);
384
385 virtual void executeUserAdd(const char* userName, const char* groups,
386 bool sshRequested, bool enabled);
387
388 virtual void executeUserDelete(const char* userName);
389
Jayanth Othayothac921a52023-07-21 03:48:55 -0500390 /** @brief clear user's failure records
391 * method to clear user fail records and throw if failed.
392 *
393 * @param[in] userName - name of the user
394 */
395 virtual void executeUserClearFailRecords(const char* userName);
396
Nan Zhouf25443e2022-10-25 00:07:11 +0000397 virtual void executeUserRename(const char* userName,
398 const char* newUserName);
399
Nan Zhoufef63032022-10-25 00:07:12 +0000400 virtual void executeUserModify(const char* userName, const char* newGroups,
401 bool sshRequested);
402
Nan Zhou6b6f2d82022-10-25 00:07:17 +0000403 virtual void executeUserModifyUserEnable(const char* userName,
404 bool enabled);
405
Nan Zhouda401fe2022-10-25 00:07:18 +0000406 virtual void executeGroupCreation(const char* groupName);
Nan Zhou86040c22022-11-17 02:08:24 +0000407
Nan Zhouda401fe2022-10-25 00:07:18 +0000408 virtual void executeGroupDeletion(const char* groupName);
Nan Zhou86040c22022-11-17 02:08:24 +0000409
Nan Zhoua2953032022-11-11 21:50:32 +0000410 virtual std::vector<std::string> getFailedAttempt(const char* userName);
411
Nan Zhou589aeb42022-10-25 00:07:09 +0000412 /** @brief check for valid privielge
413 * method to check valid privilege, and throw if invalid
414 *
415 * @param[in] priv - privilege of the user
416 */
417 void throwForInvalidPrivilege(const std::string& priv);
418
Nan Zhouecf88762022-10-25 00:07:10 +0000419 /** @brief check for valid groups
420 * method to check valid groups, and throw if invalid
421 *
422 * @param[in] groupNames - user groups
423 */
424 void throwForInvalidGroups(const std::vector<std::string>& groupName);
425
Nan Zhou4bc69812022-10-25 00:07:13 +0000426 void initializeAccountPolicy();
427
Nan Zhouda401fe2022-10-25 00:07:18 +0000428 /** @brief checks if the group creation meets all constraints
429 * @param groupName - group to check
430 */
431 void checkCreateGroupConstraints(const std::string& groupName);
432
433 /** @brief checks if the group deletion meets all constraints
434 * @param groupName - group to check
435 */
436 void checkDeleteGroupConstraints(const std::string& groupName);
437
438 /** @brief checks if the group name is legal and whether it's allowed to
439 * change. The daemon doesn't allow arbitrary group to be created
440 * @param groupName - group to check
441 */
442 void checkAndThrowForDisallowedGroupCreation(const std::string& groupName);
443
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530444 private:
445 /** @brief sdbusplus handler */
Patrick Williamsb3ef4e12022-07-22 19:26:55 -0500446 sdbusplus::bus_t& bus;
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530447
448 /** @brief object path */
449 const std::string path;
450
Abhilash Raju93804eb2024-10-01 00:24:43 -0500451 /** @brief serializer for mfa */
452 JsonSerializer serializer;
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530453 /** @brief privilege manager container */
Nan Zhouda401fe2022-10-25 00:07:18 +0000454 const std::vector<std::string> privMgr = {"priv-admin", "priv-operator",
455 "priv-user"};
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530456
457 /** @brief groups manager container */
Nan Zhouda401fe2022-10-25 00:07:18 +0000458 std::vector<std::string> groupsMgr;
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530459
460 /** @brief map container to hold users object */
Abhilash Raju93804eb2024-10-01 00:24:43 -0500461
462 std::unordered_map<std::string, std::unique_ptr<phosphor::user::Users>>
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530463 usersList;
464
465 /** @brief get users in group
466 * method to get group user list
467 *
468 * @param[in] groupName - group name
469 *
470 * @return userList - list of users in the group.
471 */
Patrick Williams9638afb2021-02-22 17:16:24 -0600472 std::vector<std::string> getUsersInGroup(const std::string& groupName);
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530473
474 /** @brief get user & SSH users list
475 * method to get the users and ssh users list.
476 *
477 *@return - vector of User & SSH user lists
478 */
479 UserSSHLists getUserAndSshGrpList(void);
480
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530481 /** @brief initialize the user manager objects
482 * method to initialize the user manager objects accordingly
483 *
484 */
485 void initUserObjects(void);
486
Ratan Guptaaeaf9412019-02-11 04:41:52 -0600487 /** @brief get service name
488 * method to get dbus service name
489 *
490 * @param[in] path - object path
491 * @param[in] intf - interface
492 * @return - service name
493 */
Patrick Williams9638afb2021-02-22 17:16:24 -0600494 std::string getServiceName(std::string&& path, std::string&& intf);
Ratan Guptaaeaf9412019-02-11 04:41:52 -0600495
Alexander Filippov75626582022-02-09 18:42:37 +0300496 /** @brief get primary group ID of specified user
Ratan Guptaaeaf9412019-02-11 04:41:52 -0600497 *
Alexander Filippov75626582022-02-09 18:42:37 +0300498 * @param[in] - userName
499 * @return - primary group ID
Ratan Guptaaeaf9412019-02-11 04:41:52 -0600500 */
Alexander Filippov75626582022-02-09 18:42:37 +0300501 virtual gid_t getPrimaryGroup(const std::string& userName) const;
Ratan Guptaaeaf9412019-02-11 04:41:52 -0600502
Alexander Filippov75626582022-02-09 18:42:37 +0300503 /** @brief check whether if the user is a member of the group
504 *
505 * @param[in] - userName
506 * @param[in] - ID of the user's primary group
507 * @param[in] - groupName
508 * @return - true if the user is a member of the group
509 */
510 virtual bool isGroupMember(const std::string& userName, gid_t primaryGid,
511 const std::string& groupName) const;
512
513 protected:
Ratan Guptaaeaf9412019-02-11 04:41:52 -0600514 /** @brief get privilege mapper object
515 * method to get dbus privilege mapper object
516 *
517 * @return - map of user object
518 */
raviteja-b8cc44052019-02-27 23:29:36 -0600519 virtual DbusUserObj getPrivilegeMapperObject(void);
520
521 friend class TestUserMgr;
Nan Zhoue48085d2022-10-25 00:07:04 +0000522
Jason M. Bills2d042d12023-03-28 15:32:45 -0700523 std::string faillockConfigFile;
Jason M. Bills3b280ec2023-08-15 16:15:48 -0700524 std::string pwHistoryConfigFile;
Jason M. Bills2d042d12023-03-28 15:32:45 -0700525 std::string pwQualityConfigFile;
Richard Marian Thomaiyar9f630d92018-05-24 10:49:10 +0530526};
527
528} // namespace user
529} // namespace phosphor