- Timestamp:
- Sep 4, 2018, 1:00:48 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Commands/WebPermissionsCmd.cs
r244 r325 1 using System;2 1 using System.Collections.Generic; 3 using System.IO;2 using AllocsFixes.NetConnections.Servers.Web; 4 3 5 using AllocsFixes.NetConnections.Servers.Web; 6 using UnityEngine; 7 8 namespace AllocsFixes.CustomCommands 9 { 4 namespace AllocsFixes.CustomCommands { 10 5 public class WebPermissionsCmd : ConsoleCmdAbstract { 11 6 public override string[] GetCommands () { 12 return new string[] { "webpermission"};7 return new[] {"webpermission"}; 13 8 } 14 15 public override string GetDescription () { 9 10 public override string GetDescription () { 16 11 return "Manage web permission levels"; 17 12 } 18 13 19 14 public override string GetHelp () { 20 15 return "Set/get permission levels required to access a given web functionality. Default\n" + 21 22 23 24 25 16 "level required for functions that are not explicitly specified is 0.\n" + 17 "Usage:\n" + 18 " webpermission add <webfunction> <level>\n" + 19 " webpermission remove <webfunction>\n" + 20 " webpermission list"; 26 21 } 27 22 28 23 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) { 29 24 if (_params.Count >= 1) { … … 46 41 } 47 42 } 48 43 49 44 private void ExecuteAdd (List<string> _params) { 50 45 if (_params.Count != 3) { … … 52 47 return; 53 48 } 54 49 55 50 if (!WebPermissions.Instance.IsKnownModule (_params [1])) { 56 51 SdtdConsole.Instance.Output ("\"" + _params [1] + "\" is not a valid web function."); 57 52 return; 58 53 } 59 54 60 55 int level; 61 56 if (!int.TryParse (_params [2], out level)) { … … 63 58 return; 64 59 } 65 60 66 61 WebPermissions.Instance.AddModulePermission (_params [1], level); 67 62 SdtdConsole.Instance.Output (string.Format ("{0} added with permission level of {1}.", _params [1], level)); 68 63 } 69 64 70 65 private void ExecuteRemove (List<string> _params) { 71 66 if (_params.Count != 2) { … … 73 68 return; 74 69 } 75 70 76 71 if (!WebPermissions.Instance.IsKnownModule (_params [1])) { 77 72 SdtdConsole.Instance.Output ("\"" + _params [1] + "\" is not a valid web function."); 78 73 return; 79 74 } 80 75 81 76 WebPermissions.Instance.RemoveModulePermission (_params [1]); 82 77 SdtdConsole.Instance.Output (string.Format ("{0} removed from permissions list.", _params [1])); 83 78 } 84 79 85 80 private void ExecuteList () { 86 81 SdtdConsole.Instance.Output ("Defined web function permissions:"); … … 90 85 } 91 86 } 92 93 87 } 94 88 }
Note:
See TracChangeset
for help on using the changeset viewer.