示例#1
0
 public static async Task<CloudRole> GetRole(string roleName)
 {
     var result = await Util.CloudRequest.POST("/role/getRole/" + roleName, null);
     var role = new CloudRole(roleName);
     role.dictionary = (Dictionary<string, Object>)result;
     return role;
 }
示例#2
0
        public bool IsInRole(CloudRole role)
        {
            if (role == null || role.GetType() != typeof(CloudRole))
            {
                throw new Exception.CloudBoostException("Role is null or its not of type CloudRole");
            }

            return(((ArrayList)(this.Get("roles"))).IndexOf(role.ID) >= 0);
        }
示例#3
0
        public static async Task <CloudRole> GetRole(string roleName)
        {
            var result = await Util.CloudRequest.Send <Dictionary <string, Object> >(Util.CloudRequest.Method.POST, "/role/getRole/" + roleName, null);

            var role = new CloudRole(roleName);

            role.dictionary = result;
            return(role);
        }
示例#4
0
        public async Task <CloudUser> RemoveFromRoleAsync(CloudRole role)
        {
            if (this.ID == null)
            {
                throw new CloudBoostException("Please save this user before you remove it from the role");
            }

            Dictionary <string, Object> postData = new Dictionary <string, object>();

            postData.Add("user", this);
            postData.Add("role", role);

            var result = await Util.CloudRequest.Send <CloudRole>(Util.CloudRequest.Method.PUT, CB.CloudApp.ApiUrl + "/user/" + CB.CloudApp.AppID + "/removeFromRole", postData);

            this.dictionary = result.dictionary;
            return(this);
        }
示例#5
0
        public async Task<CloudUser> RemoveFromRole(CloudRole role)
        {
            if (this.ID == null)
            {
                throw new CloudBoostException("Please save this user before you remove it from the role");
            }

            Dictionary<string, Object> postData = new Dictionary<string, object>();
            postData.Add("user", this);
            postData.Add("role", role);

            var result = await Util.CloudRequest.POST("/user/removeFromRole", postData);
            this.dictionary = (Dictionary<string, Object>)result;
            return this;

        }
示例#6
0
        public bool IsInRole(CloudRole role)
        {
            if (role == null || role.GetType() != typeof(CloudRole))
            {
                throw new Exception.CloudBoostException("Role is null or its not of type CloudRole");
            }

            return (((ArrayList)(this.Get("roles"))).IndexOf(role.ID) >= 0);
        }