Hi,
so I wanted to combine SM Groups with Forum Groups however I seem to not understand something or missing something obvious.
When I create the admin entry and bind it to the steam id I still do not have access.
According to GetAdminFlags used Access_Real and Effective I do have permissions but if I try to access the admin menu I do not have permission and sm_who also shows I have no permissions either.
I do use return Plugin_Handled for OnClientPreAdminCheck.
Debug Output when I first join the server after starting it:
PHP Code:
FindAdminByIdentity: -1 | INVALID_ADMIN_ID: -1
CreateAdmin: 41
Bound to identity: STEAM_0:1:22334304
AdminID: 41
GetAdminGroupCount: 0
AdminFlags Effective: 0
AdminFlags Real: 0
GetAdmGroupAddFlags: 16386
---------------------------------------
Inherited root admin group
AdminFlags Effective: 16386
AdminFlags Real: 16386
GetAdmGroupAddFlags: 16386
and this after rejoining:
PHP Code:
FindAdminByIdentity: 41 | INVALID_ADMIN_ID: -1
GetAdminGroupCount: 1
Group: Root
AdminFlags Effective: 16386
AdminFlags Real: 16386
GetAdmGroupAddFlags: 16386
---------------------------------------
AdminFlags Effective: 16386
AdminFlags Real: 16386
GetAdmGroupAddFlags: 16386
Plugin Code:
PHP Code:
void AssignAdminByGroupID(int client, int groupID)
{
AdminId admin = INVALID_ADMIN_ID;
admin = FindAdminByIdentity("steam", pInfo[client].steamID32);
PrintToServer("FindAdminByIdentity: %d | INVALID_ADMIN_ID: %d", admin, INVALID_ADMIN_ID);
if(admin == INVALID_ADMIN_ID)
{
admin = CreateAdmin(pInfo[client].username);
PrintToServer("CreateAdmin: %d", admin);
if(!admin.BindIdentity("steam", pInfo[client].steamID32))
{
RemoveAdmin(admin);
PrintToConsole(client, "There was an error assigning your admin permissions");
LogError("Failed to bind admin identity for %N (%s)", client, pInfo[client].steamID32);
}
else
{
PrintToServer("Bound to identity: %s", pInfo[client].steamID32);
}
pInfo[client].bLoaded = true;
PrintToServer("AdminID: %d", admin);
char name[PLATFORM_MAX_PATH];
int count = GetAdminGroupCount(admin);
PrintToServer("GetAdminGroupCount: %d", count);
for(int i = 0; i< count; i++)
{
GetAdminGroup(admin, i, name, sizeof(name));
PrintToServer("Group: %s", name);
}
AdminFlag flags[26];
switch(groupID)
{
case USERGROUP_MANAGEMENT:
{
PrintToServer("AdminFlags Effective: %d", GetAdminFlags(admin, Access_Effective));
PrintToServer("AdminFlags Real: %d", GetAdminFlags(admin, Access_Real));
PrintToServer("GetAdmGroupAddFlags: %d", GetAdmGroupAddFlags(admGroupRoot));
PrintToServer("---------------------------------------");
if(admin.InheritGroup(admGroupRoot))
{
PrintToServer("Inherited root admin group");
}
int num_flags = FlagBitsToArray(GetAdmGroupAddFlags(admGroupRoot), flags, sizeof(flags));
for(int i = 0; i <num_flags; i++ )
{
admin.SetFlag(flags[i], true);
}
PrintToServer("AdminFlags Effective: %d", GetAdminFlags(admin, Access_Effective));
PrintToServer("AdminFlags Real: %d", GetAdminFlags(admin, Access_Real));
PrintToServer("GetAdmGroupAddFlags: %d", GetAdmGroupAddFlags(admGroupRoot));
}
}
}
else
{
char name[PLATFORM_MAX_PATH];
if(admin.BindIdentity("steam", pInfo[client].steamID32))
{
PrintToServer("Bound to SteamID: %s", pInfo[client].steamID32);
}
int count = GetAdminGroupCount(admin);
PrintToServer("GetAdminGroupCount: %d", count);
for(int i = 0; i< count; i++)
{
GetAdminGroup(admin, i, name, sizeof(name));
PrintToServer("Group: %s", name);
}
AdminFlag flags[26];
switch(groupID)
{
case USERGROUP_MANAGEMENT:
{
PrintToServer("AdminFlags Effective: %d", GetAdminFlags(admin, Access_Effective));
PrintToServer("AdminFlags Real: %d", GetAdminFlags(admin, Access_Real));
PrintToServer("GetAdmGroupAddFlags: %d", GetAdmGroupAddFlags(admGroupRoot));
PrintToServer("---------------------------------------");
if(admin.InheritGroup(admGroupRoot))
{
PrintToServer("Inherited root admin group");
}
int num_flags = FlagBitsToArray(GetAdmGroupAddFlags(admGroupRoot), flags, sizeof(flags));
for(int i = 0; i <num_flags; i++ )
{
admin.SetFlag(flags[i], true);
}
PrintToServer("AdminFlags Effective: %d", GetAdminFlags(admin, Access_Effective));
PrintToServer("AdminFlags Real: %d", GetAdminFlags(admin, Access_Real));
PrintToServer("GetAdmGroupAddFlags: %d", GetAdmGroupAddFlags(admGroupRoot));
}
}
}
NotifyPostAdminCheck(client);
}