UltrosBot / Ultros

Connecting communities, one squid at a time! Ultros is a multi-protocol chat bot written in Python, designed with both the user and developer in mind
http://ultros.io
Artistic License 2.0
23 stars 7 forks source link

Support channel ranks in permissions #74

Open gdude2002 opened 9 years ago

gdude2002 commented 9 years ago

It's been a long time coming, and this may be somewhat related to #73, but it's finally time to tackle this. I've got an idea how I want to do this, but I'm going to need some feedback. @rakiru?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/22368529-support-channel-ranks-in-permissions?utm_campaign=plugin&utm_content=tracker%2F269930&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F269930&utm_medium=issues&utm_source=github).
rakiru commented 9 years ago
gdude2002 commented 9 years ago

For your second point..

Also, how would we reserve special group names? I mean, what would reserving do? I can't think of an appropriate restriction honestly

rakiru commented 9 years ago

How? Put a line in the docs saying "groups beginning with foo are reserved and should only be used for the intended purpose". Why? So people don't name a regular group irc-@ and get confused when Ultros does something weird with it. Perhaps a . or _ would be sensible?

gdude2002 commented 8 years ago

Alright, I decided to come back and look at this again, and I feel like it would probably not be all that hard to get this implemented into the permissions system as it is.

However, we should finalize a few things.

rakiru commented 8 years ago

Prefix for what? How would this tie in with the existing system?

gdude2002 commented 8 years ago

The prefix for the relevant permissions group.

The previous discussion seemed to decide that adding per-protocol permissions groups for sets of network-rank-related permissions was the way to go, so we need to decide what the key should be structured like.

gdude2002 commented 8 years ago

Upon review, this kinda looks really backwards.

What else can we do? Separate ranks section?

gdude2002 commented 8 years ago

I've added get_extra_groups(self, user, target=None) to the base protocol. As permissions should be pretty much self-contained, I feel like this is the best way to go as it still allows people to write their own permissions handlers if they want.

While the above layout does look pretty weird, I can't think of a way of fixing it without breaking the current permissions data files at the moment, so I'm going to press on with it for now. We can always change it later if we think of something better.

rakiru commented 8 years ago

Use cases:

Does what you've added work for all of these?

Additional use cases:

gdude2002 commented 8 years ago

It should work fine for those, but it doesn't automatically do rank inheritance - is that something we want?

rakiru commented 8 years ago

Explicit inheritance is probably fine, although it'd need to be made clear in the docs.

I just noticed, you're only returning the highest rank of the user in the IRC protocol. What's the point of main it return a list, then only returning one item? It should probably return a list of groups in order of importance.

The IRC protocol should then return all groups the user is in. Although, I guess, since the way IRC works, each group supersedes the previous, it might make more sense to either only return the top group, or return all groups under it too. Hmm...

gdude2002 commented 8 years ago

On IRC, groups are mode-based (obviously). While the only prefix shown in most clients is the highest one, technically users have only the groups in their modes. For example, on Stormbit, being a channel owner with ChanServ gives you +qo, which is irc-~ and irc-@ respectively.

I feel like we should just go with the modes and hand them all to the permissions system at this point.