0bca862419
* map tweaks/shuttle engines * helpers and defines * global/onclick * controllers and datums * mapping * game folder * some other stuff * some modules * modules that aren't mobs * some mob stuff * new player stuff * mob living * silicon stuff * simple animal things * carbon/ayylmao * update_icons * carbon/human * sounds and tools * icons and stuff * hippie grinder changes + tgui * kitchen.dmi * compile issues fixed * mapfix * Mapfixes 2.0 * mapedit2.0 * mapmerger pls * Revert "mapedit2.0" This reverts commit 74139a3cacea10df7aafca06c0a10bd3daf3a481. * clean up vore folder + 2 hotfixes * admin ticket refinement * Blob tweaks and LAZYADD * LAZYADD IS LAZY * Magic strings purged * DEFINES NEED HIGHER PRIORITIES * Only a sleepless idiot deals in absolute TRUE|FALSE * u h g * progress bar fix * reverts ticket logs * there's always that one guy * fixes and stuff * 2/27 fixes * game folder stuff * stats * some modules again * clothing stuff gets vg clothing out of the main files * everything not mobs again * mob stuff * maps, tgui, sql stuff * icons * additional fixes and compile errors * don't need this anymore * Oh right this isn't needed anymore * maint bar re-added * that doesn't need to be here * stupid events * wtfeven * probably makes Travis happy * don't care to fix the grinder atm * fixes vending sprites, changes turret * lethal, not lethals * overylays are finicky creatures * lazy fix for bleeding edgy (#252) * map tweaks/shuttle engines * helpers and defines * global/onclick * controllers and datums * mapping * game folder * some other stuff * some modules * modules that aren't mobs * some mob stuff * new player stuff * mob living * silicon stuff * simple animal things * carbon/ayylmao * update_icons * carbon/human * sounds and tools * icons and stuff * hippie grinder changes + tgui * kitchen.dmi * compile issues fixed * mapfix * Mapfixes 2.0 * mapedit2.0 * mapmerger pls * Revert "mapedit2.0" This reverts commit 74139a3cacea10df7aafca06c0a10bd3daf3a481. * clean up vore folder + 2 hotfixes * admin ticket refinement * Blob tweaks and LAZYADD * LAZYADD IS LAZY * Magic strings purged * DEFINES NEED HIGHER PRIORITIES * Only a sleepless idiot deals in absolute TRUE|FALSE * u h g * progress bar fix * reverts ticket logs * there's always that one guy * fixes and stuff * 2/27 fixes * game folder stuff * stats * some modules again * clothing stuff gets vg clothing out of the main files * everything not mobs again * mob stuff * maps, tgui, sql stuff * icons * additional fixes and compile errors * don't need this anymore * Oh right this isn't needed anymore * maint bar re-added * that doesn't need to be here * stupid events * wtfeven * probably makes Travis happy * don't care to fix the grinder atm * fixes vending sprites, changes turret * lethal, not lethals * overylays are finicky creatures
131 lines
4.6 KiB
Plaintext
131 lines
4.6 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/output = {"<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Permissions Panel</title>
|
|
<script type='text/javascript' src='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:375px;'>PERMISSIONS</th>
|
|
<th style='width:100%;'>VERB-OVERRIDES</th>
|
|
</tr>
|
|
"}
|
|
|
|
for(var/adm_ckey in admin_datums)
|
|
var/datum/admins/D = admin_datums[adm_ckey]
|
|
if(!D)
|
|
continue
|
|
|
|
var/rights = rights2text(D.rank.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]'>[D.rank.name]</a></td>"
|
|
output += "<td><a class='small' href='?src=\ref[src];editrights=permissions;ckey=[adm_ckey]'>[rights]</a></td>"
|
|
output += "<td><a class='small' href='?src=\ref[src];editrights=permissions;ckey=[adm_ckey]'>[rights2text(0," ",D.rank.adds,D.rank.subs)]</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=900x650")
|
|
|
|
/datum/admins/proc/log_admin_rank_modification(adm_ckey, new_rank)
|
|
if(config.admin_legacy_system)
|
|
return
|
|
|
|
if(!usr.client)
|
|
return
|
|
|
|
if (!check_rights(R_PERMISSIONS))
|
|
return
|
|
|
|
if(!dbcon.Connect())
|
|
usr << "<span class='danger'>Failed to establish database connection.</span>"
|
|
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 [format_table_name("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 `[format_table_name("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 `[format_table_name("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()
|
|
usr << "<span class='adminnotice'>New admin added.</span>"
|
|
else
|
|
if(!isnull(admin_id) && isnum(admin_id))
|
|
var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `[format_table_name("admin")]` SET rank = '[new_rank]' WHERE id = [admin_id]")
|
|
insert_query.Execute()
|
|
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `[format_table_name("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()
|
|
usr << "<span class='adminnnotice'>Admin rank changed.</span>"
|
|
|
|
|
|
/datum/admins/proc/log_admin_permission_modification(adm_ckey, new_permission)
|
|
if(config.admin_legacy_system)
|
|
return
|
|
if(!usr.client)
|
|
return
|
|
if(check_rights(R_PERMISSIONS))
|
|
return
|
|
|
|
if(!dbcon.Connect())
|
|
usr << "<span class='danger'>Failed to establish database connection.</span>"
|
|
return
|
|
|
|
if(!adm_ckey || !istext(adm_ckey) || !isnum(new_permission))
|
|
return
|
|
|
|
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, flags FROM [format_table_name("admin")] WHERE ckey = '[adm_ckey]'")
|
|
select_query.Execute()
|
|
|
|
var/admin_id
|
|
while(select_query.NextRow())
|
|
admin_id = text2num(select_query.item[1])
|
|
|
|
if(!admin_id)
|
|
return
|
|
|
|
var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `[format_table_name("admin")]` SET flags = [new_permission] WHERE id = [admin_id]")
|
|
insert_query.Execute()
|
|
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Edit permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]');")
|
|
log_query.Execute()
|