MCPcopy Create free account
hub / github.com/cuberite/cuberite / LoadPermissionsFromDisk

Method LoadPermissionsFromDisk

src/Entities/Player.cpp:1514–1552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1512
1513
1514void cPlayer::LoadPermissionsFromDisk()
1515{
1516 m_Groups.clear();
1517 m_Permissions.clear();
1518
1519 cIniFile IniFile;
1520 if (IniFile.ReadFile("users.ini"))
1521 {
1522 std::string Groups = IniFile.GetValue(m_PlayerName, "Groups", "");
1523 if (!Groups.empty())
1524 {
1525 AStringVector Split = StringSplitAndTrim(Groups, ",");
1526 for (AStringVector::const_iterator itr = Split.begin(), end = Split.end(); itr != end; ++itr)
1527 {
1528 if (!cRoot::Get()->GetGroupManager()->ExistsGroup(*itr))
1529 {
1530 LOGWARNING("The group %s for player %s was not found!", itr->c_str(), m_PlayerName.c_str());
1531 }
1532 AddToGroup(*itr);
1533 }
1534 }
1535 else
1536 {
1537 AddToGroup("Default");
1538 }
1539
1540 AString Color = IniFile.GetValue(m_PlayerName, "Color", "-");
1541 if (!Color.empty())
1542 {
1543 m_Color = Color[0];
1544 }
1545 }
1546 else
1547 {
1548 cGroupManager::GenerateDefaultUsersIni(IniFile);
1549 AddToGroup("Default");
1550 }
1551 ResolvePermissions();
1552}
1553
1554
1555

Callers

nothing calls this directly

Calls 10

StringSplitAndTrimFunction · 0.85
clearMethod · 0.80
ReadFileMethod · 0.80
GetValueMethod · 0.80
emptyMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
ExistsGroupMethod · 0.80
GetGroupManagerMethod · 0.80
c_strMethod · 0.80

Tested by

no test coverage detected