예제 #1
0
        public static void ReloadRoles()
        {
            if (RoleList.Count > 0)
            {
                RoleList.RemoveAll(v => true);
            }

            JObject config = JObject.Parse(File.ReadAllText("permissions.json"));

            foreach (JProperty role in ((JObject)config.SelectToken("Roles")).Properties())
            {
                Role newRole = new Role(role.Name);
                foreach (JToken command in config.SelectToken($"Roles.{role.Name}"))
                {
                    newRole.Commands.Add(command.ToString());
                }
                RoleList.Add(newRole);
            }
        }
예제 #2
0
 public static bool IsPermitted(Role role, string command)
 {
     // TODO
     return true;
 }