-
Notifications
You must be signed in to change notification settings - Fork 8
Channel ACLs #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Channel ACLs #79
Conversation
That is how event handlers work by default. By default access is always granted and must be explicitly denied: if any handler denies access then access is denied completely. If nothing denies access then access is granted. Explicit grants however are possible, if event handler returns |
|
For privilege and player factions / groups support, one way to implement backend db would be this: {
owner = {
["president"] = true, -- Allow player named `president` to do everything like chat, manage managers, delete channel and so on.
},
manager = {
["$privs"] = true, -- Allow players with `privs` privilege to chat and manage users.
["sam"] = true -- Allow player named `sam` to chat and manage users.
},
user = {
["@Tree House Clan"] = true, -- Allow `Tree House Clan` faction members to chat.
["gandalf"] = true -- Allow player named `gandalf` to chat.
},
read = {
["!@Mosters"] = true, -- Allow everyone but `Monsters` faction members to read channel.
}
}Empty table would enforce auto propagated checks. Missing table would skip checks for that role and follow normal access resolution through other registered restrictions. Adding metatables when loading db allows easily checking for higher privs, lookup should already be fast enough for that. This would be simply exploiting the fact that characters in player names are restricted, easy to check matches without much special handling for different mods implementing player groups. Could even allow Update 2025:Identities are handled through separately registered identity providers. Identity providers are fairly simple:
|
59e4555 to
f0cd733
Compare
b7cccde to
53dd3ff
Compare
beerchat.join_channel rework backwards compatible way Update chatcommands Update ACLs / actual permission checks Add beerchat.capture_message Password query / single shot override everything Privilege based ACL roles + other updates Remove password from /jc command Cleanup /cc Remove ACLs with -d switch Rename channel_name
|
This is going to need some play testing on actual server. Things to test:
It does also change basic message formatting parameters channel_name -> channel and channel_password -> password so custom format strings might break. Stats: |
beerchat.join_channel rework backwards compatible way Update chatcommands Update ACLs / actual permission checks Add beerchat.capture_message Password query / single shot override everything Privilege based ACL roles + other updates Remove password from /jc command Cleanup /cc Remove ACLs with -d switch Rename channel_name
beerchat.join_channel rework backwards compatible way Update chatcommands Update ACLs / actual permission checks Add beerchat.capture_message Password query / single shot override everything Privilege based ACL roles + other updates Remove password from /jc command Cleanup /cc Remove ACLs with -d switch Rename channel_name
|
Edit: not going to do this. Chat command can be updated later if needed. |
|
Took only bit over two years to check few boxes 🐌 |
beerchat.join_channel rework backwards compatible way Update chatcommands Update ACLs / actual permission checks Add beerchat.capture_message / password query / single shot override everything Privilege based ACL roles + other updates Remove password from /jc command Cleanup /cc command Remove ACLs with -d switch Rename channel_name Rework password protected join Refactor privilege roles -> generic identity providers Fix some bugs and corner cases
|
Rebased to master. Kind of finished I think but one thing is missing: actually saving changes to persistent storage. Storage is available, just |
beerchat.join_channel rework backwards compatible way Update chatcommands Update ACLs / actual permission checks Add beerchat.capture_message / password query / single shot override everything Privilege based ACL roles + other updates Remove password from /jc command Cleanup /cc command Remove ACLs with -d switch Rename channel_name Rework password protected join Refactor privilege roles -> generic identity providers Fix some bugs and corner cases Better UX for chat commands
|
Fixed UX issues and reduced risks of mental health issues after using chat commands. Also added calls to
|
Test password query ACL/acls basic tests Tests for /mc Test ACL removal Remove print from channel ban test Test common ACL combinations and chat commands Test chat feedback for player deny
beerchat.join_channel rework backwards compatible way Update chatcommands Update ACLs / actual permission checks Add beerchat.capture_message / password query / single shot override everything Privilege based ACL roles + other updates Remove password from /jc command Cleanup /cc command Remove ACLs with -d switch Rename channel_name Rework password protected join Refactor privilege roles -> generic identity providers Fix some bugs and corner cases Better UX for chat commands
|
Cleaned up commits, singleplayer setting for tests also isn't really needed. |
Simple access control lists for channels.
Possible roles are:
denyAccess to channel is denied.readCan read messages sent to channel.writeCan send messages to channel.managerCan managedeny,readandwriteACLs for channel.ownerCan manage all ACLs, including channel owners.Primary channel owner (player who created channel) cannot be removed or changed, this is not the same as ACL owner role.
ACLs will not affect primary owner in any way, this primary owner information is checked but not managed by ACL plugin.
Default access role, when ACLs are not used for channel, is
write.Identities and identity providers
Possible built in identities for ACL matching are:
$, for example$interact. Matches players who has that privilege.*. Default privilege for channel, used when no better match found.Primary function of identity provider is to translate player name into valid secondary identities.
For example, take in player name and return list of available privileges.
Adding different identities can be done by registering new identity provider, for example see
plugin/acl/privileges.lua.Channel invites
Basic channel invite command
/ichas been removed.Command didn't actually do anything besides playing a sound and sending a message with
/jcinstructions.Adding player specific ACL will also send invite message.
Adding privilege based (players with privilege) or default role (everyone) wont send invite messages.
Channel passwords
Password handling have been mostly moved from core to ACL plugin.
Beerchat now asks for password when attempting to join password protected channel,
/jcwont accept password at all (however it could still do that but access checks still requires ACL plugin).Chat commands
/ca <Channel Name> [[-d] <Identity> [Access Role]]/channel_aclSame as above / alias./icSame as above / alias. Should this be removed while at it❓/invite_channelSame as above / alias. Should this be removed while at it❓I had plans to reorder chat command arguments but not going to do it for this PR. Updating chat command can be easily done later if needed.
Examples
Ban single player from channel:
/ca #main Sam denyAllow players with staff privilege to send messages while everyone else can just read:
/ca #main * read/ca #main $staff writeIt's anarchy server (though even this wont allow overriding primary owner):
/ca #main * ownerKnown shortcomings
Ordering of multiple roles isn't currently guaranteed in any way across identity providers other than player name is always first and fallback role is always last.
First explicitly defined role is returned instead of returning highest or lowest permission.
Though currently ordering is known as there's only player name, privilege and fallback.
Left this undefined and undecided for now, behavior could be changed later.
Stats for change set