Lines Matching refs:groupName
127 void checkAndThrowsForGroupChangeAllowed(const std::string& groupName) in checkAndThrowsForGroupChangeAllowed() argument
132 if (groupName.starts_with(prefix)) in checkAndThrowsForGroupChangeAllowed()
141 groupName); in checkAndThrowsForGroupChangeAllowed()
143 Argument::ARGUMENT_VALUE(groupName.c_str())); in checkAndThrowsForGroupChangeAllowed()
207 const std::string& groupName) in checkAndThrowForDisallowedGroupCreation() argument
209 if (groupName.size() > maxSystemGroupNameLength || in checkAndThrowForDisallowedGroupCreation()
210 !std::regex_match(groupName.c_str(), in checkAndThrowForDisallowedGroupCreation()
213 lg2::error("Invalid group name '{GROUP}'", "GROUP", groupName); in checkAndThrowForDisallowedGroupCreation()
215 Argument::ARGUMENT_VALUE(groupName.c_str())); in checkAndThrowForDisallowedGroupCreation()
217 checkAndThrowsForGroupChangeAllowed(groupName); in checkAndThrowForDisallowedGroupCreation()
414 void UserMgr::checkDeleteGroupConstraints(const std::string& groupName) in checkDeleteGroupConstraints() argument
416 if (std::find(groupsMgr.begin(), groupsMgr.end(), groupName) == in checkDeleteGroupConstraints()
419 lg2::error("Group '{GROUP}' already exists", "GROUP", groupName); in checkDeleteGroupConstraints()
422 checkAndThrowsForGroupChangeAllowed(groupName); in checkDeleteGroupConstraints()
425 void UserMgr::deleteGroup(std::string groupName) in deleteGroup() argument
427 checkDeleteGroupConstraints(groupName); in deleteGroup()
430 executeGroupDeletion(groupName.c_str()); in deleteGroup()
434 lg2::error("Failed to delete group '{GROUP}'", "GROUP", groupName); in deleteGroup()
438 groupsMgr.erase(std::find(groupsMgr.begin(), groupsMgr.end(), groupName)); in deleteGroup()
440 lg2::info("Successfully deleted group '{GROUP}'", "GROUP", groupName); in deleteGroup()
443 void UserMgr::checkCreateGroupConstraints(const std::string& groupName) in checkCreateGroupConstraints() argument
445 if (std::find(groupsMgr.begin(), groupsMgr.end(), groupName) != in checkCreateGroupConstraints()
448 lg2::error("Group '{GROUP}' already exists", "GROUP", groupName); in checkCreateGroupConstraints()
451 checkAndThrowForDisallowedGroupCreation(groupName); in checkCreateGroupConstraints()
460 void UserMgr::createGroup(std::string groupName) in createGroup() argument
462 checkCreateGroupConstraints(groupName); in createGroup()
465 executeGroupCreation(groupName.c_str()); in createGroup()
469 lg2::error("Failed to create group '{GROUP}'", "GROUP", groupName); in createGroup()
472 groupsMgr.push_back(groupName); in createGroup()
1011 std::vector<std::string> UserMgr::getUsersInGroup(const std::string& groupName) in getUsersInGroup() argument
1019 int status = getgrnam_r(groupName.c_str(), &grp, buffer.data(), in getUsersInGroup()
1031 lg2::error("Group '{GROUPNAME}' not found", "GROUPNAME", groupName); in getUsersInGroup()
1124 const std::string& groupName) const in isGroupMember()
1137 auto status = getgrnam_r(groupName.c_str(), &grp, buffer.data(), in isGroupMember()
1152 status = getgrnam_r(groupName.c_str(), &grp, buffer.data(), in isGroupMember()
1177 groupName); in isGroupMember()
1181 lg2::error("Group {GROUP} does not exist", "GROUP", groupName); in isGroupMember()
1187 void UserMgr::executeGroupCreation(const char* groupName) in executeGroupCreation() argument
1189 executeCmd("/usr/sbin/groupadd", groupName); in executeGroupCreation()
1192 void UserMgr::executeGroupDeletion(const char* groupName) in executeGroupDeletion() argument
1194 executeCmd("/usr/sbin/groupdel", groupName); in executeGroupDeletion()
1256 std::string groupName; in getUserInfo() local
1262 groupName = std::get<std::string>(propValue); in getUserInfo()
1270 if (!groupName.empty() && !privilege.empty() && in getUserInfo()
1271 isGroupMember(userName, primaryGid, groupName)) in getUserInfo()