mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 03:02:54 +00:00
Merge pull request #8330 from PsiOmegaDelta/Access
Increased check_rights flexibility.
This commit is contained in:
@@ -50,21 +50,21 @@ proc/admin_proc()
|
|||||||
NOTE: it checks usr! not src! So if you're checking somebody's rank in a proc which they did not call
|
NOTE: it checks usr! not src! So if you're checking somebody's rank in a proc which they did not call
|
||||||
you will have to do something like if(client.holder.rights & R_ADMIN) yourself.
|
you will have to do something like if(client.holder.rights & R_ADMIN) yourself.
|
||||||
*/
|
*/
|
||||||
/proc/check_rights(rights_required, show_msg=1)
|
/proc/check_rights(rights_required, show_msg=1, var/mob/user = usr)
|
||||||
if(usr && usr.client)
|
if(user && user.client)
|
||||||
if(rights_required)
|
if(rights_required)
|
||||||
if(usr.client.holder)
|
if(user.client.holder)
|
||||||
if(rights_required & usr.client.holder.rights)
|
if(rights_required & user.client.holder.rights)
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
if(show_msg)
|
if(show_msg)
|
||||||
usr << "<font color='red'>Error: You do not have sufficient rights to do that. You require one of the following flags:[rights2text(rights_required," ")].</font>"
|
user << "<font color='red'>Error: You do not have sufficient rights to do that. You require one of the following flags:[rights2text(rights_required," ")].</font>"
|
||||||
else
|
else
|
||||||
if(usr.client.holder)
|
if(user.client.holder)
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
if(show_msg)
|
if(show_msg)
|
||||||
usr << "<font color='red'>Error: You are not an admin.</font>"
|
user << "<font color='red'>Error: You are not an admin.</font>"
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
//probably a bit iffy - will hopefully figure out a better solution
|
//probably a bit iffy - will hopefully figure out a better solution
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
return STATUS_CLOSE // By default no mob can do anything with NanoUI
|
return STATUS_CLOSE // By default no mob can do anything with NanoUI
|
||||||
|
|
||||||
/mob/dead/observer/can_use_topic()
|
/mob/dead/observer/can_use_topic()
|
||||||
if(check_rights(R_ADMIN, 0))
|
if(check_rights(R_ADMIN, 0, src))
|
||||||
return STATUS_INTERACTIVE // Admins are more equal
|
return STATUS_INTERACTIVE // Admins are more equal
|
||||||
return STATUS_UPDATE // Ghosts can view updates
|
return STATUS_UPDATE // Ghosts can view updates
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user