mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2025-12-09 15:28:26 +00:00
* Time to become our TGUI God. * Visually sprucing the copyrights. These shouldn't be ignored :) * babababa * https://github.com/tgstation/tgstation/pull/50422 * dooootdooot * Holy fuck Updates the tools folder Updates our build tooling Updates TGUI MASSIVELY I'm going to go scream in a hole now * ?? * Was it this dum thing? * orrrr * It's this isn't it * Did it manually * hubah * TGUI Changelog * oops * What if I use the original? * Lets try this again * Shit commenting out for now * asdasd * Fuck it use the old one and remember to replace later * Updates yarn.lock * Lets try something horrid * Nope it HATES THAT * fucc * The great eslinting * HOLY SHIT * Final? * ? * asd tgstation/tgstation/pull/59914 tgstation/tgstation/pull/66317 * Improved Asset handling. * Oops * Subsystem stuff * Recompiles the Changelong again. * Finally Fixed Communicators * Compiled Changelogs... AGAIN
154 lines
5.8 KiB
Plaintext
154 lines
5.8 KiB
Plaintext
/client/proc/edit_admin_permissions()
|
|
set category = "Admin"
|
|
set name = "Permissions Panel"
|
|
set desc = "Edit admin permissions"
|
|
if(!check_rights(R_PERMISSIONS))
|
|
return
|
|
usr.client.holder.edit_admin_permissions()
|
|
|
|
/datum/admins/proc/edit_admin_permissions()
|
|
if(!check_rights(R_PERMISSIONS))
|
|
return
|
|
var/datum/asset/asset_cache_datum = get_asset_datum(/datum/asset/group/permissions)
|
|
asset_cache_datum.send(usr)
|
|
|
|
var/output = {"<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Permissions Panel</title>
|
|
<script type='text/javascript' src='[SSassets.transport.get_asset_url("search.js")]'></script>
|
|
<link rel='stylesheet' type='text/css' href='panels.css'>
|
|
</head>
|
|
<body onload='selectTextField();updateSearch();'>
|
|
<div id='main'><table id='searchable' cellspacing='0'>
|
|
<tr class='title'>
|
|
<th style='width:125px;text-align:right;'>CKEY <a class='small' href='?src=\ref[src];editrights=add'>\[+\]</a></th>
|
|
<th style='width:125px;'>RANK</th><th style='width:100%;'>PERMISSIONS</th>
|
|
</tr>
|
|
"}
|
|
|
|
for(var/adm_ckey in admin_datums)
|
|
var/datum/admins/D = admin_datums[adm_ckey]
|
|
if(!D) continue
|
|
var/rank = D.rank ? D.rank : "*none*"
|
|
var/rights = rights2text(D.rights," ")
|
|
if(!rights) rights = "*none*"
|
|
|
|
output += "<tr>"
|
|
output += "<td style='text-align:right;'>[adm_ckey] <a class='small' href='?src=\ref[src];editrights=remove;ckey=[adm_ckey]'>\[-\]</a></td>"
|
|
output += "<td><a href='?src=\ref[src];editrights=rank;ckey=[adm_ckey]'>[rank]</a></td>"
|
|
output += "<td><a class='small' href='?src=\ref[src];editrights=permissions;ckey=[adm_ckey]'>[rights]</a></td>"
|
|
output += "</tr>"
|
|
|
|
output += {"
|
|
</table></div>
|
|
<div id='top'><b>Search:</b> <input type='text' id='filter' value='' style='width:70%;' onkeyup='updateSearch();'></div>
|
|
</body>
|
|
</html>"}
|
|
|
|
usr << browse(output,"window=editrights;size=600x500")
|
|
|
|
/datum/admins/proc/log_admin_rank_modification(var/adm_ckey, var/new_rank)
|
|
if(config_legacy.admin_legacy_system) return
|
|
|
|
if(!usr.client)
|
|
return
|
|
|
|
if(!usr.client.holder || !(usr.client.holder.rights & R_PERMISSIONS))
|
|
to_chat(usr, "<font color='red'>You do not have permission to do this!</font>")
|
|
return
|
|
|
|
establish_db_connection()
|
|
|
|
if(!dbcon.IsConnected())
|
|
to_chat(usr, "<font color='red'>Failed to establish database connection</font>")
|
|
return
|
|
|
|
if(!adm_ckey || !new_rank)
|
|
return
|
|
|
|
adm_ckey = ckey(adm_ckey)
|
|
|
|
if(!adm_ckey)
|
|
return
|
|
|
|
if(!istext(adm_ckey) || !istext(new_rank))
|
|
return
|
|
|
|
var/DBQuery/select_query = dbcon.NewQuery("SELECT id FROM erro_admin WHERE ckey = '[adm_ckey]'")
|
|
select_query.Execute()
|
|
|
|
var/new_admin = 1
|
|
var/admin_id
|
|
while(select_query.NextRow())
|
|
new_admin = 0
|
|
admin_id = text2num(select_query.item[1])
|
|
|
|
if(new_admin)
|
|
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO `erro_admin` (`id`, `ckey`, `rank`, `level`, `flags`) VALUES (null, '[adm_ckey]', '[new_rank]', -1, 0)")
|
|
insert_query.Execute()
|
|
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added new admin [adm_ckey] to rank [new_rank]');")
|
|
log_query.Execute()
|
|
to_chat(usr, "<font color=#4F49AF>New admin added.</font>")
|
|
else
|
|
if(!isnull(admin_id) && isnum(admin_id))
|
|
var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `erro_admin` SET rank = '[new_rank]' WHERE id = [admin_id]")
|
|
insert_query.Execute()
|
|
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Edited the rank of [adm_ckey] to [new_rank]');")
|
|
log_query.Execute()
|
|
to_chat(usr, "<font color=#4F49AF>Admin rank changed.</font>")
|
|
|
|
/datum/admins/proc/log_admin_permission_modification(var/adm_ckey, var/new_permission)
|
|
if(config_legacy.admin_legacy_system) return
|
|
|
|
if(!usr.client)
|
|
return
|
|
|
|
if(!usr.client.holder || !(usr.client.holder.rights & R_PERMISSIONS))
|
|
to_chat(usr, "<font color='red'>You do not have permission to do this!</font>")
|
|
return
|
|
|
|
establish_db_connection()
|
|
if(!dbcon.IsConnected())
|
|
to_chat(usr, "<font color='red'>Failed to establish database connection</font>")
|
|
return
|
|
|
|
if(!adm_ckey || !new_permission)
|
|
return
|
|
|
|
adm_ckey = ckey(adm_ckey)
|
|
|
|
if(!adm_ckey)
|
|
return
|
|
|
|
if(istext(new_permission))
|
|
new_permission = text2num(new_permission)
|
|
|
|
if(!istext(adm_ckey) || !isnum(new_permission))
|
|
return
|
|
|
|
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, flags FROM erro_admin WHERE ckey = '[adm_ckey]'")
|
|
select_query.Execute()
|
|
|
|
var/admin_id
|
|
var/admin_rights
|
|
while(select_query.NextRow())
|
|
admin_id = text2num(select_query.item[1])
|
|
admin_rights = text2num(select_query.item[2])
|
|
|
|
if(!admin_id)
|
|
return
|
|
|
|
if(admin_rights & new_permission) //This admin already has this permission, so we are removing it.
|
|
var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `erro_admin` SET flags = [admin_rights & ~new_permission] WHERE id = [admin_id]")
|
|
insert_query.Execute()
|
|
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Removed permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]');")
|
|
log_query.Execute()
|
|
to_chat(usr, "<font color=#4F49AF>Permission removed.</font>")
|
|
else //This admin doesn't have this permission, so we are adding it.
|
|
var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `erro_admin` SET flags = '[admin_rights | new_permission]' WHERE id = [admin_id]")
|
|
insert_query.Execute()
|
|
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]')")
|
|
log_query.Execute()
|
|
to_chat(usr, "<font color=#4F49AF>Permission added.</font>")
|