optimized srvstart/srvstop permission checks

pull/2/head
Aaron Johnson 7 years ago
parent a7a88a7886
commit f6e775a759

@ -25,15 +25,13 @@ end
def process_command_srvstart(message, command, adm) def process_command_srvstart(message, command, adm)
puts "Received command: srvstart" puts "Received command: srvstart"
#pp message #pp message
if ! message_from_admin?(message, adm) from_admin = message_from_admin?(message, adm)
####if ! message.from.username.nil? auth_grp = is_chat_authorized?(message, @auth_chat)
#### message.from.username = "@" + message.from.username if ! auth_grp && ! from_admin
####elsif ! message.from.first_name.nil? return "Refusal: I am not authorized to perform this function for this group, meatbag."
#### message.from.username = message.from.first_name elsif ! from_admin
####end
#return "#{message.from.username} is not an admin!"
return "Refusal: The meatbag #{message.from.username} is not my master." return "Refusal: The meatbag #{message.from.username} is not my master."
elsif message_from_admin?(message, adm) && ! is_chat_authorized?(message, @auth_chat) elsif ! auth_grp
return "Refusal: Although I respect your wishes, master, I am not authorized to perform this function for this group." return "Refusal: Although I respect your wishes, master, I am not authorized to perform this function for this group."
else else
telnet = @conf['telnet'] telnet = @conf['telnet']
@ -46,15 +44,13 @@ end
def process_command_srvstop(message, command, adm) def process_command_srvstop(message, command, adm)
puts "Received command: srvstop" puts "Received command: srvstop"
if ! message_from_admin?(message, adm) from_admin = message_from_admin?(message, adm)
####if ! message.from.username.nil? auth_grp = is_chat_authorized?(message, @auth_chat)
#### message.from.username = "@" + message.from.username if ! auth_grp && ! from_admin
####elsif ! message.from.first_name.nil? return "Refusal: I am not authorized to perform this function for this group, meatbag."
#### message.from.username = message.from.first_name elsif ! from_admin
####end
#return "#{message.from.username} is not an admin!"
return "Refusal: The meatbag #{message.from.username} is not my master." return "Refusal: The meatbag #{message.from.username} is not my master."
elsif message_from_admin?(message, adm) && ! is_chat_authorized?(message, @auth_chat) elsif ! auth_grp
return "Refusal: Although I respect your wishes, master, I am not authorized to perform this function for this group." return "Refusal: Although I respect your wishes, master, I am not authorized to perform this function for this group."
else else
telnet = @conf['telnet'] telnet = @conf['telnet']

Loading…
Cancel
Save