57 lines
1.9 KiB
Lua
57 lines
1.9 KiB
Lua
|
|
BleeterPermissions = {}
|
|||
|
|
|
|||
|
|
local feedPostRights = {
|
|||
|
|
private = { home = true },
|
|||
|
|
small_business = { advertising = true },
|
|||
|
|
company = { advertising = true },
|
|||
|
|
authority = { home = true, advertising = true },
|
|||
|
|
lifeinvader = {}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function BleeterPermissions.CanPost(profileType, feedType)
|
|||
|
|
local rights = feedPostRights[profileType or ''] or {}
|
|||
|
|
return rights[feedType or ''] == true
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function BleeterPermissions.CanInteract(profile)
|
|||
|
|
return profile and profile.is_locked ~= true and profile.is_active ~= false
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--- Anbieterrechte (Lifeinvader).
|
|||
|
|
---
|
|||
|
|
--- Erste Quelle ist die Anmeldung am PC: wer als admin@liveinvader.ls
|
|||
|
|
--- angemeldet ist, hat alle Rechte. Damit haengt Bleeter an derselben Stelle
|
|||
|
|
--- wie das Webhosting, statt eine zweite Rechteliste zu fuehren.
|
|||
|
|
---
|
|||
|
|
--- Die alte Tabelle bleibt als zweiter Weg bestehen – der Notausgang, falls
|
|||
|
|
--- ic-web einmal nicht laeuft.
|
|||
|
|
function BleeterPermissions.HasLifeinvaderPermission(source, permission)
|
|||
|
|
if IcWebAdapter and IcWebAdapter.IsProvider(source) then
|
|||
|
|
return true
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
if SuperPcAdapter and SuperPcAdapter.HasLifeinvaderPermission then
|
|||
|
|
return SuperPcAdapter.HasLifeinvaderPermission(source, permission)
|
|||
|
|
end
|
|||
|
|
return false
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
--- Darf diese Person die Mitglieder dieses Profils verwalten?
|
|||
|
|
--- Der Anbieter immer; sonst nur, wer im Profil ausdruecklich dafuer
|
|||
|
|
--- eingetragen ist. Wer nur posten darf, soll sich nicht selbst weitere
|
|||
|
|
--- Rechte holen koennen.
|
|||
|
|
function BleeterPermissions.CanManageMembers(source, charId, profileId)
|
|||
|
|
if BleeterPermissions.HasLifeinvaderPermission(source, 'profile.staff') then
|
|||
|
|
return true
|
|||
|
|
end
|
|||
|
|
if not charId or charId == '' or not profileId then return false end
|
|||
|
|
|
|||
|
|
local row = MySQL.single.await([[
|
|||
|
|
SELECT 1 AS ok FROM bleeter_profile_members
|
|||
|
|
WHERE profile_id = ? AND char_id = ? AND can_manage_members = 1
|
|||
|
|
LIMIT 1
|
|||
|
|
]], { profileId, charId })
|
|||
|
|
|
|||
|
|
return row ~= nil
|
|||
|
|
end
|