Ejemplo n.º 1
0
        public bool SetUserPermission(string steamIdOruserName, string permNode, bool allowed)
        {
            string steamId = PlayerUtils.GetSteamID(steamIdOruserName);

            if (SDTM.API.Permissions.Users.ContainsKey(steamId))
            {
                PermissionUser setPermUser = SDTM.API.Permissions.Users [steamId];

                if (setPermUser.Permissions.Set(permNode, allowed))
                {
                    SDTM.API.Permissions.Save();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                PermissionUser newUser = new PermissionUser(steamId);
                newUser.Permissions.Set(permNode, allowed);
                SDTM.API.Permissions.Users.Add(steamId, newUser);
                SDTM.API.Permissions.Save();
                return(true);
            }
        }
Ejemplo n.º 2
0
        public bool SetUserGroup(string steamIdOrUserName, string groupName)
        {
            if (!this.Groups.ContainsKey(groupName))
            {
                return(false);
            }

            string         steamId = PlayerUtils.GetSteamID(steamIdOrUserName);
            PermissionUser user;

            if (!this.Users.ContainsKey(steamId))
            {
                user         = new PermissionUser(steamId);
                user.SteamId = steamId;
                user.Group   = groupName;
                this.Users.Add(steamId, user);
                GameManager.Instance.adminTools.AddAdmin(steamId, this.Groups [groupName].AdminLevel);
            }
            else
            {
                user       = this.Users [steamId];
                user.Group = groupName;
                GameManager.Instance.adminTools.AddAdmin(steamId, this.Groups [groupName].AdminLevel);
                this.Users [steamId] = user;
            }

            return(false);
        }
Ejemplo n.º 3
0
        public bool Load()
        {
            string configPath = SDTM.API.configDataPath;

            if (FileUtils.ensureDirectoryExists(configPath))
            {
                configPath = configPath + "/experm.xml";

                if (!File.Exists(configPath))
                {
                    return(false);
                }

                XmlDocument xmlDoc = new XmlDocument();
                try{
                    xmlDoc.Load(configPath);
                }
                catch (XmlException e) {
                    Log.Error(string.Format("[ExPerm] Could not Load Config: {0}", e.Message));
                    return(false);
                }

                XmlNode rootNode         = xmlDoc.DocumentElement;
                XmlNode defaultGroupAttr = rootNode.Attributes.GetNamedItem("defaultgroup");
                if (defaultGroupAttr != null)
                {
                    this.DefaultGroupName = defaultGroupAttr.Value;
                }
                foreach (XmlNode configNode in rootNode.ChildNodes)
                {
                    switch (configNode.Name.ToLower())
                    {
                    case "groups":
                        foreach (XmlNode groupNode in configNode.ChildNodes)
                        {
                            PermissionGroup g = new PermissionGroup(groupNode);
                            Log.Out("Added Group: " + g.Name);
                            this.Groups.Add(g.Name, g);
                        }
                        break;

                    case "users":
                        foreach (XmlNode userNode in configNode.ChildNodes)
                        {
                            PermissionUser u = new PermissionUser(userNode);
                            this.Users.Add(u.SteamId, u);
                        }
                        break;
                    }
                }

                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
        public bool ClearUserPermission(string steamIdOrUserName, string permNode)
        {
            string steamId = PlayerUtils.GetSteamID(steamIdOrUserName);

            if (SDTM.API.Permissions.Users.ContainsKey(steamId))
            {
                PermissionUser setPermUser = SDTM.API.Permissions.Users [steamId];

                if (setPermUser.Permissions.Remove(permNode))
                {
                    SDTM.API.Permissions.Save();
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 5
0
        public bool isAllowed(string _steamIdOrUserName, string _permissionNode)
        {
            bool allowed = false;

            string steamId = PlayerUtils.GetSteamID(_steamIdOrUserName);

            if (_superGroup.Contains(steamId))
            {
                return(true);
            }

            if (Users.ContainsKey(steamId))
            {
                PermissionUser user      = Users [steamId];
                string         groupName = user.Group;
                if (groupName != null && groupName != "")
                {
                    if (Groups.ContainsKey(groupName))
                    {
                        allowed = Groups [groupName].Permissions.Get(_permissionNode);
                    }
                }

                if (Users [steamId].Permissions.Exists(_permissionNode))
                {
                    allowed = Users [steamId].Permissions.Get(_permissionNode);
                }
            }
            else                //default group
            {
                if (Groups.ContainsKey(this.DefaultGroupName))
                {
                    allowed = Groups [this.DefaultGroupName].Permissions.Get(_permissionNode);
                }
            }

            return(allowed);
        }
Ejemplo n.º 6
0
        public void ProcessUserCommand(List <string> _params, CommandSenderInfo _senderInfo)
        {
            string userCommand = "";

            if (_params.Count == 1)
            {
                userCommand = "list";
            }
            else
            {
                userCommand = _params [1].ToLower();
            }

            SDTM.API thisMod           = SDTM.API.Instance;
            string   steamIdOrUsername = "";
            string   steamId           = "";

            ClientInfo p;

            switch (userCommand)
            {
            case "list":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.user.list") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (SDTM.API.Permissions.Users.Count > 0)
                {
                    foreach (KeyValuePair <string, PermissionUser> kvp in SDTM.API.Permissions.Users)
                    {
                        PermissionUser user = kvp.Value;
                        SdtdConsole.Instance.Output(user.SteamId + "\t" + user.DisplayName + "\t" + user.Group);
                    }
                }
                else
                {
                    SdtdConsole.Instance.Output("[ExPerm] No ExPerm Users found.");
                }
                break;

            case "group":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.user.setgroup") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 4)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Parameter Count");
                    return;
                }

                steamIdOrUsername = _params [2];
                string groupName = _params [3];

                //p = PlayerUtils.GetPlayer (steamIdOrUsername);
                p = PlayerUtils.GetClientInfo(steamIdOrUsername);
                if (p == null)
                {
                    if (SDTM.API.Permissions.Users.ContainsKey(steamIdOrUsername))
                    {
                        steamId = steamIdOrUsername;
                    }
                    else
                    {
                        //TODO: see if we can load the player by the username

                        SdtdConsole.Instance.Output("[ExPerm] Player not found: " + steamIdOrUsername);
                        return;
                    }
                }
                else
                {
                    steamId = p.playerId;
                }

                if (steamId == null || steamId == "")
                {
                    if (p == null)
                    {
                        SdtdConsole.Instance.Output("[ExPerm] You cannot create an ExPerm User for a player that is not online.");
                    }
                    else
                    {
                        SdtdConsole.Instance.Output("[ExPerm] Player not Found: " + steamIdOrUsername);
                    }
                    return;
                }

                PermissionUser userPerm;
                if (SDTM.API.Permissions.Users.ContainsKey(steamId))
                {
                    userPerm = SDTM.API.Permissions.Users [steamId];
                }
                else
                {
                    userPerm             = new PermissionUser(steamId);
                    userPerm.DisplayName = p.playerName;
                }

                if (SDTM.API.Permissions.Groups.ContainsKey(groupName) == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Group not Found: " + groupName);
                    return;
                }

                userPerm.Group = groupName;
                SDTM.API.Permissions.Users [steamId] = userPerm;
                SDTM.API.Permissions.Save();
                SdtdConsole.Instance.Output("[ExPerm] Player's Group Updated.");
                break;

            case "remove":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.user.remove") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 3)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Parameter Count");
                    return;
                }

                steamIdOrUsername = _params [2];

                p = PlayerUtils.GetClientInfo(steamIdOrUsername);                 //PlayerUtils.GetPlayer (steamIdOrUsername);

                if (p == null)
                {
                    if (SDTM.API.Permissions.Users.ContainsKey(steamIdOrUsername))
                    {
                        steamId = steamIdOrUsername;
                    }
                    else
                    {
                        //TODO: see if we can load the player by the username

                        SdtdConsole.Instance.Output("[ExPerm] Player not found: " + steamIdOrUsername);
                        return;
                    }
                }
                else
                {
                    steamId = p.playerId;
                }

                if (steamId == null || steamId == "")
                {
                    if (p == null)
                    {
                        SdtdConsole.Instance.Output("[ExPerm] You cannot remove an ExPerm User for a player that is not online.");
                    }
                    else
                    {
                        SdtdConsole.Instance.Output("[ExPerm] Player not Found: " + steamIdOrUsername);
                    }
                    return;
                }

                if (SDTM.API.Permissions.Users.ContainsKey(steamId))
                {
                    if (SDTM.API.Permissions.Users.Remove(steamId))
                    {
                        SDTM.API.Permissions.Save();
                        SdtdConsole.Instance.Output("[ExPerm] ExPerm Player Data removed");
                    }
                    else
                    {
                        SdtdConsole.Instance.Output("[ExPerm] Could not remove ExPerm Player Data.");
                    }
                }

                break;

            case "setperm":
                //experm user setperm chromecide perm.name true
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.user.setperm") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 5)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Parameter Count");
                    return;
                }

                steamIdOrUsername = _params [2];

                p = PlayerUtils.GetClientInfo(steamIdOrUsername);

                if (p == null)
                {
                    if (SDTM.API.Permissions.Users.ContainsKey(steamIdOrUsername))
                    {
                        steamId = steamIdOrUsername;
                    }
                    else
                    {
                        //TODO: see if we can load the player by the username

                        SdtdConsole.Instance.Output("[ExPerm] Player not found: " + steamIdOrUsername);
                        return;
                    }
                }
                else
                {
                    steamId = p.playerId;
                }

                SdtdConsole.Instance.Output("STEAM ID:" + steamId);

                if (steamId == null || steamId == "")
                {
                    if (p == null)
                    {
                        SdtdConsole.Instance.Output("[ExPerm] You cannot remove an ExPerm User for a player that is not online.");
                    }
                    else
                    {
                        SdtdConsole.Instance.Output("[ExPerm] Player not Found: " + steamIdOrUsername);
                    }
                    return;
                }

                string permNode   = _params [3];
                bool   bIsAllowed = _params [4].ToLower() == "true" ? true : false;

                if (SDTM.API.Permissions.Users.ContainsKey(steamId))
                {
                    PermissionUser setPermUser = SDTM.API.Permissions.Users [steamId];

                    if (setPermUser.Permissions.Set(permNode, bIsAllowed))
                    {
                        SDTM.API.Permissions.Save();
                        SdtdConsole.Instance.Output("[ExPerm] Permission set Successfully.");
                    }
                    else
                    {
                        SdtdConsole.Instance.Output("[ExPerm] Could not set User Permission.");
                    }
                }
                else
                {
                    PermissionUser newUser = new PermissionUser(steamId);
                    newUser.Permissions.Set(permNode, bIsAllowed);
                    SDTM.API.Permissions.Users.Add(steamId, newUser);
                    SDTM.API.Permissions.Save();
                    SdtdConsole.Instance.Output("[ExPerm] Permission set Successfully.");
                }

                break;

            case "removeperm":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.user.removeperm") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 4)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Parameter Count");
                    return;
                }

                steamIdOrUsername = _params [2];

                p = PlayerUtils.GetClientInfo(steamIdOrUsername);

                if (p == null)
                {
                    if (SDTM.API.Permissions.Users.ContainsKey(steamIdOrUsername))
                    {
                        steamId = steamIdOrUsername;
                    }
                    else
                    {
                        //TODO: see if we can load the player by the username

                        SdtdConsole.Instance.Output("[ExPerm] Player not found: " + steamIdOrUsername);
                        return;
                    }
                }
                else
                {
                    steamId = p.playerId;
                }

                SdtdConsole.Instance.Output("STEAM ID:" + steamId);

                if (steamId == null || steamId == "")
                {
                    if (p == null)
                    {
                        SdtdConsole.Instance.Output("[ExPerm] You cannot remove an ExPerm User for a player that is not online.");
                    }
                    else
                    {
                        SdtdConsole.Instance.Output("[ExPerm] Player not Found: " + steamIdOrUsername);
                    }
                    return;
                }

                string sPermNode = _params [3];

                if (SDTM.API.Permissions.Users.ContainsKey(steamId))
                {
                    PermissionUser setPermUser = SDTM.API.Permissions.Users [steamId];
                    if (setPermUser.Permissions.Remove(sPermNode))
                    {
                        SDTM.API.Permissions.Save();
                        SdtdConsole.Instance.Output("[ExPerm] Permission removed Successfully.");
                    }
                    else
                    {
                        SdtdConsole.Instance.Output("[ExPerm] Could not remove User Permission.");
                    }
                }
                else
                {
                    SdtdConsole.Instance.Output("[ExPerm] Player not found: " + steamIdOrUsername);
                }
                break;

            case "clearperms":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.user.removeperm") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 3)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Parameter Count");
                    return;
                }

                steamIdOrUsername = _params [2];

                p = PlayerUtils.GetClientInfo(steamIdOrUsername);

                if (p == null)
                {
                    if (SDTM.API.Permissions.Users.ContainsKey(steamIdOrUsername))
                    {
                        steamId = steamIdOrUsername;
                    }
                    else
                    {
                        //TODO: see if we can load the player by the username

                        SdtdConsole.Instance.Output("[ExPerm] Player not found: " + steamIdOrUsername);
                        return;
                    }
                }
                else
                {
                    steamId = p.playerId;
                }

                if (steamId == null || steamId == "")
                {
                    if (p == null)
                    {
                        SdtdConsole.Instance.Output("[ExPerm] You cannot Clear Permissions for a player that is not online.");
                    }
                    else
                    {
                        SdtdConsole.Instance.Output("[ExPerm] Player not Found: " + steamIdOrUsername);
                    }
                    return;
                }

                if (SDTM.API.Permissions.Users.ContainsKey(steamId))
                {
                    PermissionUser setPermUser = SDTM.API.Permissions.Users [steamId];

                    if (setPermUser.Permissions.RemoveAll())
                    {
                        SDTM.API.Permissions.Save();
                        SdtdConsole.Instance.Output("[ExPerm] Permission Cleared Successfully.");
                    }
                    else
                    {
                        SdtdConsole.Instance.Output("[ExPerm] Could not clear User Permission.");
                    }
                }
                else
                {
                    SdtdConsole.Instance.Output("[ExPerm] Player not found: " + steamIdOrUsername);
                }
                break;

            case "test":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.user.test") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                bool allowed = API.Permissions.isAllowed(_params [2], _params [3]);
                SdtdConsole.Instance.Output("Allowed: " + (allowed?"Yes":"No"));
                break;

            case "info":
                steamIdOrUsername = _params [2];

                p = PlayerUtils.GetClientInfo(steamIdOrUsername);

                if (p == null)
                {
                    if (SDTM.API.Permissions.Users.ContainsKey(steamIdOrUsername))
                    {
                        steamId = steamIdOrUsername;
                    }
                    else
                    {
                        //TODO: see if we can load the player by the username

                        SdtdConsole.Instance.Output("[ExPerm] Player not found: " + steamIdOrUsername);
                        return;
                    }
                }
                else
                {
                    steamId = p.playerId;
                    SdtdConsole.Instance.Output("STEAM ID:" + steamId);
                }

                if (steamId == null || steamId == "")
                {
                    SdtdConsole.Instance.Output("[ExPerm] Player not Found: " + steamIdOrUsername);
                    return;
                }

                if (SDTM.API.Permissions.Users.ContainsKey(steamId))
                {
                    PermissionUser userInfo = SDTM.API.Permissions.Users [steamId];
                    if (userInfo == null)
                    {
                        SdtdConsole.Instance.Output("[ExPerm] No user information for: " + steamId);
                        return;
                    }

                    SdtdConsole.Instance.Output("[ExPerm] ExPerm User Information");
                    SdtdConsole.Instance.Output("SteamID: " + userInfo.SteamId);
                    SdtdConsole.Instance.Output("Display: " + userInfo.DisplayName);
                    SdtdConsole.Instance.Output("Group: " + (userInfo.Group == ""?"No Group":userInfo.Group));
                    SdtdConsole.Instance.Output("Permissions");
                    Dictionary <string, bool> perms = userInfo.Permissions.GetAll();
                    foreach (KeyValuePair <string, bool> kvp in perms)
                    {
                        SdtdConsole.Instance.Output(kvp.Key + " - " + (kvp.Value == true?"Allowed":"Denied"));
                    }
                }
                else
                {
                    SdtdConsole.Instance.Output("[ExPerm] Player not Found: " + steamIdOrUsername);
                }

                break;
            }
        }
Ejemplo n.º 7
0
        public void ProcessGroupCommand(List <string> _params, CommandSenderInfo _senderInfo)
        {
            string userCommand = "";

            if (_params.Count == 1)
            {
                userCommand = "list";
            }
            else
            {
                userCommand = _params [1].ToLower();
            }

            SDTM.API thisMod = SDTM.API.Instance;

            string groupName;

            switch (userCommand)
            {
            case "list":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.group.list") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (SDTM.API.Permissions.Groups.Count > 0)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Groups List");
                    foreach (KeyValuePair <string, PermissionGroup> kvp in SDTM.API.Permissions.Groups)
                    {
                        PermissionGroup grp  = kvp.Value;
                        string          sOut = grp.Name;
                        if (grp.Name == SDTM.API.Permissions.DefaultGroupName)
                        {
                            sOut += "(Default Group)";
                        }
                        SdtdConsole.Instance.Output(sOut);
                    }
                }
                else
                {
                    SdtdConsole.Instance.Output("[ExPerm] No ExPerm Groups found.");
                }

                break;

            case "info":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.group.info") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 3)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Parameter Count.");
                    return;
                }

                groupName = _params [2].ToLower();

                if (!SDTM.API.Permissions.Groups.ContainsKey(groupName))
                {
                    SdtdConsole.Instance.Output("[ExPerm] Group not Found.");
                    return;
                }

                PermissionGroup pGrp = SDTM.API.Permissions.Groups [groupName];
                SdtdConsole.Instance.Output("[ExPerm] Group Information");
                SdtdConsole.Instance.Output("Name: " + pGrp.Name);
                SdtdConsole.Instance.Output("Default: " + (pGrp.Name == SDTM.API.Permissions.DefaultGroupName ? "Yes" : "No"));
                SdtdConsole.Instance.Output("Permissions: ");
                Dictionary <string, bool> perms = pGrp.Permissions.GetAll();
                foreach (KeyValuePair <string, bool> kvp in perms)
                {
                    SdtdConsole.Instance.Output(kvp.Key + " - " + (kvp.Value == true?"Allowed":"Denied"));
                }
                break;

            case "create":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.group.create") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 3)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Parameter Count.");
                    return;
                }

                groupName = _params [2].ToLower();

                if (SDTM.API.Permissions.Groups.ContainsKey(groupName))
                {
                    SdtdConsole.Instance.Output("[ExPerm] Group Already Exists");
                    return;
                }

                if (SDTM.API.Permissions.AddGroup(groupName))
                {
                    SDTM.API.Permissions.Save();
                    SdtdConsole.Instance.Output("[ExPerm] Group created Successfully.");
                }
                else
                {
                    SdtdConsole.Instance.Output("[ExPerm] Could not create Group.");
                }

                break;

            case "rename":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.group.modify") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 4)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Parameter Count.");
                    return;
                }


                groupName = _params [2].ToLower();

                if (!SDTM.API.Permissions.Groups.ContainsKey(groupName))
                {
                    SdtdConsole.Instance.Output("[ExPerm] Group not Found.");
                    return;
                }

                string newGroupName = _params [3].ToLower();

                if (SDTM.API.Permissions.Groups.ContainsKey(newGroupName))
                {
                    SdtdConsole.Instance.Output("[ExPerm] Group already Exists: " + newGroupName);
                    return;
                }

                PermissionGroup grp1 = SDTM.API.Permissions.Groups [groupName];

                if (grp1 == null)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Group Object not Found: " + groupName);
                    return;
                }

                grp1.Name = newGroupName;
                SDTM.API.Permissions.Groups.Remove(groupName);
                SDTM.API.Permissions.Groups.Add(newGroupName, grp1);
                foreach (KeyValuePair <string, PermissionUser> grp1User in SDTM.API.Permissions.Users)
                {
                    PermissionUser grpRenUser = grp1User.Value;
                    if (grpRenUser.Group == groupName)
                    {
                        grpRenUser.Group = newGroupName;
                        SDTM.API.Permissions.Users [grp1User.Key] = grpRenUser;
                    }
                }

                if (groupName == SDTM.API.Permissions.DefaultGroupName)
                {
                    SDTM.API.Permissions.DefaultGroupName = newGroupName;
                }
                SDTM.API.Permissions.Save();
                SdtdConsole.Instance.Output("[ExPerm] Group renamed successfully.");
                break;

            case "remove":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.group.remove") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 3)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Parameter Count.");
                    return;
                }


                groupName = _params [2].ToLower();

                if (!SDTM.API.Permissions.Groups.ContainsKey(groupName))
                {
                    SdtdConsole.Instance.Output("[ExPerm] Group not Found.");
                    return;
                }

                if (groupName == SDTM.API.Permissions.DefaultGroupName)
                {
                    SdtdConsole.Instance.Output("[ExPerm] You can not remove the default group.");
                    return;
                }

                if (SDTM.API.Permissions.Groups.Remove(groupName))
                {
                    SdtdConsole.Instance.Output("[ExPerm] Group removed.");
                }
                else
                {
                    SdtdConsole.Instance.Output("[ExPerm] Could not remove Group.");
                }
                break;

            case "default":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.group.default") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 3)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Parameter Count.");
                    return;
                }

                groupName = _params [2].ToLower();

                if (!SDTM.API.Permissions.Groups.ContainsKey(groupName))
                {
                    SdtdConsole.Instance.Output("[ExPerm] Group not Found.");
                    return;
                }

                SDTM.API.Permissions.DefaultGroupName = groupName;
                SDTM.API.Permissions.Save();

                SdtdConsole.Instance.Output("[ExPerm] Default Group Updated");
                break;

            case "setperm":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.group.setperm") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 5)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Paramater Count.");
                    return;
                }

                groupName = _params [2].ToLower();
                string permName   = _params [3];
                bool   bIsAllowed = _params [4].ToLower() == "true" ? true : false;
                if (!SDTM.API.Permissions.Groups.ContainsKey(groupName))
                {
                    SdtdConsole.Instance.Output("[ExPerm] Group could not be Found.");
                    return;
                }

                if (SDTM.API.Permissions.Groups [groupName].SetPermission(permName, bIsAllowed))
                {
                    SDTM.API.Permissions.Save();
                    SdtdConsole.Instance.Output("[ExPerm] Group permission set Successfully.");
                }
                else
                {
                    SdtdConsole.Instance.Output("[ExPerm] Could not set Group Permission.");
                }

                break;

            case "removeperm":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.group.removeperm") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 4)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Paramater Count.");
                    return;
                }

                groupName = _params [2].ToLower();
                string sPermName = _params [3];

                if (!SDTM.API.Permissions.Groups.ContainsKey(groupName))
                {
                    SdtdConsole.Instance.Output("[ExPerm] Group could not be Found.");
                    return;
                }

                if (SDTM.API.Permissions.Groups [groupName].RemovePermission(sPermName))
                {
                    SDTM.API.Permissions.Save();
                    SdtdConsole.Instance.Output("[ExPerm] Group permission removed Successfully.");
                }
                else
                {
                    SdtdConsole.Instance.Output("[ExPerm] Could not remove Group Permission.");
                }
                break;

            case "clearperms":
                if (SDTM.API.Permissions.isAllowed(_senderInfo.RemoteClientInfo, "permissions.user.removeperm") == false)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Permission Denied");
                    return;
                }

                if (_params.Count != 3)
                {
                    SdtdConsole.Instance.Output("[ExPerm] Invalid Parameter Count");
                    return;
                }

                groupName = _params [2].ToLower();

                if (SDTM.API.Permissions.Groups.ContainsKey(groupName))
                {
                    PermissionGroup setPermGroup = SDTM.API.Permissions.Groups [groupName];

                    if (setPermGroup.Permissions.RemoveAll())
                    {
                        SDTM.API.Permissions.Save();
                        SdtdConsole.Instance.Output("[ExPerm] Permissions Cleared Successfully.");
                    }
                    else
                    {
                        SdtdConsole.Instance.Output("[ExPerm] Could not clear Group Permissions.");
                    }
                }
                else
                {
                    SdtdConsole.Instance.Output("[ExPerm] Group not found: " + groupName);
                }
                break;
            }
        }