Author Topic: Flags System Revision?  (Read 2249 times)

0 Members and 1 Guest are viewing this topic.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10320
  • In Soviet Russia, text read you!
    • View Profile
    • William's Blog
Flags System Revision?
« on: September 23, 2009, 01:05:21 PM »
I need you guy's input on this. I'm thinking of revising the flag system, along with new security features.

Here's the ranks, which will be applied to the flags:

Administrator: Has all the privileges of a moderator (and therefore, safelisted), as well as the right to zaplist people, and connect/disconnect the bot. This rank can only be added or removed from the bot's console.
Moderator: Has all the privileges of a safelisted user, as well as the right to kick/ban people and add them to the banlist. This rank can only be added or removed by administrators.
Friend: Cannot be kicked except by administrators. This rank can only be added or removed by administrators or above.
Safelist: Cannot be kicked by any automatic means. This rank can only be added or removed by administrators or above.
Banlist: Will be banned upon entry, except if they also are an administrator, moderator, or are safelisted. Example, "*[x86]*" could be banlisted, and "joe[x86]" could have administrator. Therefore, "joe[x86]" would be a banlisted administrator, and not kicked. This rank can only be assigned by moderators or above.
Zaplist: Will be banned upon entry except for administrators. This rank can only be added or removed by administrators.

And the flags:
A - Administrator
B - Banlist
C - Unused
D - Unused
E - Unused

F - Friend
G - Unused
H - Unused
I - Unused
J - Unused
K - Unused
L - Unused

M - Moderator
N - Unused
O - Unused
P - Unused
Q - Unused
R - Unused

S - Safelist
T - Unused
U - Unused
V - Unused
W - Unused
X - Unused
Y - Unused

Z - Zaplist
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Chavo

  • x86
  • Hero Member
  • *****
  • Posts: 2229
  • no u
    • View Profile
    • Chavoland
Re: Flags System Revision?
« Reply #1 on: September 23, 2009, 01:30:58 PM »
Back when I used javaop (many many moons ago), I modified the Moderation plugin to use a more heirarchal approach by using some of the flags as ranks with the leftover flags still be usable for whatever.

This code predates my knowledge of how to use regex, so it could be improved on, but the idea is basic and easy:
Code: [Select]

private final String ALL = "ABCDEFGHIJLKMNOPQRSTUVWXYZ";
private final String DEBUGGER = "ABCDEFGHIJLKNOPQRSTUVWXYZ";
private final String ADMIN = "ABCDEFGHIJLKOPQRSTUVWXYZ";
private final String MOD = "BCEFGHIJLKOPQRSTUVWXYZ";

[snip]

// Determine what flags a user can modify based on the user's own flags
private String getAllowedChanges(String flags)  
{
if(flags.indexOf("M") > -1)  // local user
return ALL;
else if(flags.indexOf("N") > -1) // special flag used for raised commands, internal interplugin communication
return DEBUGGER;
else if (flags.indexOf("C") > -1)
return ADMIN;
else if (flags.indexOf("D") > -1 || flags.indexOf("V") > -1 || flags.indexOf("A") > -1)  // I don't remember why I had multiple types of MOD flags
return MOD;
else
return "";
}

I also found it very useful to have a flag that would cause any commands from the user to be ignored.  This was useful because, unlike squelch, the users comments were still logged and they could still take part in other things like using /me to sign in for game creation.