Skip to content

Commit

Permalink
Admin ranks now use bitfields for permissions. Rather than checking t…
Browse files Browse the repository at this point in the history
…he name of the rank, adminverbs will now check holder.rights to see if it has certain bits turned on.

SERVER HOSTS:
This commit replaces the existing admin-rank system. It is now more customizable.
Admin.txt essentially works the same as it always has. Each line should look like:
ckey - admin rank

There is now however, an admin_ranks.txt. This textfile allows you to define ranks like so:
admin rank +ADMIN +FUN +BUILD
the +KEYWORD are flags adding permissions to that rank. There are brief descriptions in the text-file explaining what they do.

You can now name the ranks anything you like, and give them the permissions you want them to have. This allows, for instance, ranks like:
Game Admin on disciplinary +ADMIN +BAN
This would give that game admin only the tools they need to admin. They would not have access to 'fun' verbs which control events and antags.
There's lots of things you can do. For instance, a coder rank whom can debug stuff but cannot do admin tasks:
Codermin +DEBUG +VAREDIT +SERVER

There's lots you can do. As it evolves it will hopefully become more flexible.

admin_ranks.txt defaults to use the old admin rank names.

Apologies in advance as there will be a lot of anomalies, such as ranks losing verbs they once had. Please let me know about any problems. I can fix them quite easily simply by moving verbs between the lists or splitting the lists up into new flags.

CODERS:
There is now a check_rights(flags) proc. 
It check is usr is and admin and has -at least one of- the rights specified.
It checks > usr < not src, so keep that in mind!
If you need to check if something other than usr has specific tights, you can do if(holder.rights & R_ADMIN) etc.

KNOWN ISSUES:
+FUN probably needs to be split up into +MOBS and +EVENTS
In-game promotion/demotion is currently disabled. It will be readded after everything else works ok.
Erro's sql rights changes stuff is currently commented out. It will be re-added.
There are still many many verbs which need updating.

Apologies in advance for any inconvenience.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4991 316c924e-a436-60f5-8080-3fe189b3f50e
  • Loading branch information
[email protected] committed Nov 2, 2012
1 parent d46775e commit 50fe648
Show file tree
Hide file tree
Showing 33 changed files with 3,470 additions and 4,218 deletions.
4 changes: 2 additions & 2 deletions code/WorkInProgress/buildmode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@
if(objholder in removed_paths)
alert("That path is not allowed.")
objholder = "/obj/structure/closet"
else if (dd_hasprefix(objholder, "/mob") && !(usr.client.holder.rank in list("Game Master", "Game Admin", "Badmin")))
else if (dd_hasprefix(objholder, "/mob") && !check_rights(R_DEBUG,0))
objholder = "/obj/structure/closet"
if(3)
var/list/locked = list("vars", "key", "ckey", "client", "firemut", "ishulk", "telekinesis", "xray", "virus", "viruses", "cuffed", "ka", "last_eaten", "urine")

master.buildmode.varholder = input(usr,"Enter variable name:" ,"Name", "name")
if(master.buildmode.varholder in locked && !(usr.client.holder.rank in list("Game Master", "Game Admin")))
if(master.buildmode.varholder in locked && !check_rights(R_DEBUG,0))
return
var/thetype = input(usr,"Select variable type:" ,"Type") in list("text","number","mob-reference","obj-reference","turf-reference")
if(!thetype) return
Expand Down
16 changes: 16 additions & 0 deletions code/__HELPERS/type2type.dm
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,19 @@ proc/tg_list2text(list/list, glue=",")
/proc/angle2text(var/degree)
return dir2text(angle2dir(degree))


//Converts a rights bitfield into a string
/proc/rights2text(rights)
if(rights & R_BUILDMODE) . += "+BUILDMODE"
if(rights & R_ADMIN) . += "+ADMIN"
if(rights & R_BAN) . += "+BAN"
if(rights & R_FUN) . += "+FUN"
if(rights & R_SERVER) . += "+SERVER"
if(rights & R_DEBUG) . += "+DEBUG"
if(rights & R_POSSESS) . += "+POSSESS"
if(rights & R_PERMISSIONS) . += "+PERMISSIONS"
if(rights & R_STEALTH) . += "+STEALTH"
if(rights & R_REJUVINATE) . += "+REJUVINATE"
if(rights & R_VAREDIT) . += "+VAREDIT"
if(rights & R_SOUNDS) . += "+SOUND"
return .
2 changes: 1 addition & 1 deletion code/controllers/voting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ datum/controller/vote
var/trialmin = 0
if(C.holder)
admin = 1
if (C.holder.level >= 3)
if (C.holder.rights & R_ADMIN)
trialmin = 1
voting |= C

Expand Down
Loading

0 comments on commit 50fe648

Please sign in to comment.