forked from TeamUlysses/ulib
Update CAMI, and ignored some bad data passed by other addons. This addresses #504, but won't fix the underlying issue of another addon trying to do something bad.
This commit is contained in:
parent
d24b8e48f3
commit
2e7d06958d
@ -14,7 +14,9 @@
|
||||
CAMI.ULX_TOKEN = "ULX"
|
||||
|
||||
local function onGroupRegistered( camiGroup, originToken )
|
||||
-- Ignore if ULX is the source, or if we receive bad data from another addon
|
||||
if originToken == CAMI.ULX_TOKEN then return end
|
||||
if ULib.findInTable( {"superadmin", "admin", "user"}, camiGroup.Name ) then return end
|
||||
|
||||
if not ULib.ucl.groups[ camiGroup.Name ] then
|
||||
ULib.ucl.addGroup( camiGroup.Name, nil, camiGroup.Inherits, true )
|
||||
@ -25,7 +27,9 @@ end
|
||||
hook.Add( "CAMI.OnUsergroupRegistered", "ULXCamiGroupRegistered", onGroupRegistered )
|
||||
|
||||
local function onGroupRemoved( camiGroup, originToken )
|
||||
-- Ignore if ULX is the source, or if we receive bad data from another addon
|
||||
if originToken == CAMI.ULX_TOKEN then return end
|
||||
if ULib.findInTable( {"superadmin", "admin", "user"}, camiGroup.Name ) then return end
|
||||
|
||||
ULib.ucl.removeGroup( camiGroup.Name, true )
|
||||
end
|
||||
|
@ -41,7 +41,7 @@ Structures:
|
||||
]]
|
||||
|
||||
-- Version number in YearMonthDay format.
|
||||
local version = 20150820
|
||||
local version = 20150823
|
||||
|
||||
if CAMI and CAMI.Version >= version then return end
|
||||
|
||||
@ -345,9 +345,8 @@ CAMI.PlayerHasAccess
|
||||
-- Default access handler
|
||||
local defaultAccessHandler = {["CAMI.PlayerHasAccess"] =
|
||||
function(_, actorPly, privilegeName, callback, _, extraInfoTbl)
|
||||
if not IsValid(actorPly) then return callback(false, "Fallback.") end
|
||||
-- The server always has access in the fallback
|
||||
if actorPly:EntIndex() == 0 then return callback(true, "Fallback.") end
|
||||
if not IsValid(actorPly) then return callback(true, "Fallback.") end
|
||||
|
||||
local priv = privileges[privilegeName]
|
||||
|
||||
@ -500,3 +499,29 @@ CAMI.SignalUserGroupChanged
|
||||
function CAMI.SignalUserGroupChanged(ply, old, new, source)
|
||||
hook.Call("CAMI.PlayerUsergroupChanged", nil, ply, old, new, source)
|
||||
end
|
||||
|
||||
--[[
|
||||
CAMI.SignalSteamIDUserGroupChanged
|
||||
Signify that your admin mod has changed the usergroup of a disconnected
|
||||
player. This communicates to other admin mods what it thinks the usergroup
|
||||
of a player should be.
|
||||
|
||||
Listen to the hook to receive the usergroup changes of other admin mods.
|
||||
|
||||
Parameters:
|
||||
ply
|
||||
string
|
||||
The steam ID of the player for which the usergroup is changed
|
||||
old
|
||||
string
|
||||
The previous usergroup of the player.
|
||||
new
|
||||
string
|
||||
The new usergroup of the player.
|
||||
source
|
||||
any
|
||||
Identifier for your own admin mod. Can be anything.
|
||||
]]
|
||||
function CAMI.SignalSteamIDUserGroupChanged(steamId, old, new, source)
|
||||
hook.Call("CAMI.SteamIDUsergroupChanged", nil, steamId, old, new, source)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user