40 lines
1.1 KiB
Lua
40 lines
1.1 KiB
Lua
|
|
SuperPcAdapter = {}
|
||
|
|
|
||
|
|
local businessStatus = {}
|
||
|
|
|
||
|
|
function SuperPcAdapter.GetBusinessStatus(handle)
|
||
|
|
return businessStatus[handle] or 'closed'
|
||
|
|
end
|
||
|
|
|
||
|
|
function SuperPcAdapter.SetBusinessStatus(handle, status)
|
||
|
|
if not handle or handle == '' then return false end
|
||
|
|
if status ~= 'open' and status ~= 'closed' then return false end
|
||
|
|
businessStatus[handle] = status
|
||
|
|
return true
|
||
|
|
end
|
||
|
|
|
||
|
|
function SuperPcAdapter.GetProfileMemberships(_source)
|
||
|
|
return {}
|
||
|
|
end
|
||
|
|
|
||
|
|
function SuperPcAdapter.HasLifeinvaderPermission(_source, _permission)
|
||
|
|
local identity = IfruitAdapter and IfruitAdapter.GetAccountIdentity and IfruitAdapter.GetAccountIdentity(_source)
|
||
|
|
local charId = identity and identity.charId or ''
|
||
|
|
local permission = tostring(_permission or '')
|
||
|
|
|
||
|
|
if charId == '' or permission == '' then
|
||
|
|
return false
|
||
|
|
end
|
||
|
|
|
||
|
|
local row = MySQL.single.await([[
|
||
|
|
SELECT id
|
||
|
|
FROM bleeter_lifeinvader_permissions
|
||
|
|
WHERE char_id = ?
|
||
|
|
AND allowed = 1
|
||
|
|
AND permission IN (?, '*', 'admin')
|
||
|
|
LIMIT 1
|
||
|
|
]], { charId, permission })
|
||
|
|
|
||
|
|
return row ~= nil
|
||
|
|
end
|