Lines Matching defs:groupName

127 void checkAndThrowsForGroupChangeAllowed(const std::string& groupName)
132 if (groupName.starts_with(prefix))
141 groupName);
143 Argument::ARGUMENT_VALUE(groupName.c_str()));
226 const std::string& groupName)
228 if (groupName.size() > maxSystemGroupNameLength ||
229 !std::regex_match(groupName.c_str(),
232 lg2::error("Invalid group name '{GROUP}'", "GROUP", groupName);
234 Argument::ARGUMENT_VALUE(groupName.c_str()));
236 checkAndThrowsForGroupChangeAllowed(groupName);
433 void UserMgr::checkDeleteGroupConstraints(const std::string& groupName)
435 if (std::find(groupsMgr.begin(), groupsMgr.end(), groupName) ==
438 lg2::error("Group '{GROUP}' already exists", "GROUP", groupName);
441 checkAndThrowsForGroupChangeAllowed(groupName);
444 void UserMgr::deleteGroup(std::string groupName)
446 checkDeleteGroupConstraints(groupName);
449 executeGroupDeletion(groupName.c_str());
453 lg2::error("Failed to delete group '{GROUP}'", "GROUP", groupName);
457 groupsMgr.erase(std::find(groupsMgr.begin(), groupsMgr.end(), groupName));
459 lg2::info("Successfully deleted group '{GROUP}'", "GROUP", groupName);
462 void UserMgr::checkCreateGroupConstraints(const std::string& groupName)
464 if (std::find(groupsMgr.begin(), groupsMgr.end(), groupName) !=
467 lg2::error("Group '{GROUP}' already exists", "GROUP", groupName);
470 checkAndThrowForDisallowedGroupCreation(groupName);
479 void UserMgr::createGroup(std::string groupName)
481 checkCreateGroupConstraints(groupName);
484 executeGroupCreation(groupName.c_str());
488 lg2::error("Failed to create group '{GROUP}'", "GROUP", groupName);
491 groupsMgr.push_back(groupName);
1039 std::vector<std::string> UserMgr::getUsersInGroup(const std::string& groupName)
1047 int status = getgrnam_r(groupName.c_str(), &grp, buffer.data(),
1059 lg2::error("Group '{GROUPNAME}' not found", "GROUPNAME", groupName);
1153 const std::string& groupName) const
1166 auto status = getgrnam_r(groupName.c_str(), &grp, buffer.data(),
1181 status = getgrnam_r(groupName.c_str(), &grp, buffer.data(),
1206 groupName);
1210 lg2::error("Group {GROUP} does not exist", "GROUP", groupName);
1216 void UserMgr::executeGroupCreation(const char* groupName)
1218 executeCmd("/usr/sbin/groupadd", groupName);
1221 void UserMgr::executeGroupDeletion(const char* groupName)
1223 executeCmd("/usr/sbin/groupdel", groupName);
1287 std::string groupName;
1293 groupName = std::get<std::string>(propValue);
1301 if (!groupName.empty() && !privilege.empty() &&
1302 isGroupMember(userName, primaryGid, groupName))