Esempio n. 1
0
        public ApiMessage UpdateRoleActions()
        {
            ApiMessage message = new ApiMessage() { Status = "ok" };
            HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request = context.Request;
            string user_id = User.Identity.Name;
            UserManager userMgr = new UserManager(int.Parse(user_id), null);
            BUser user = userMgr.CurrentUser;
            PermissionManagement permissionMgt = new PermissionManagement(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);

            int role_id = 0;
            int[] actions = null;
            int.TryParse(request["role"], out role_id);
            try
            {
                actions = this.ConvertToIntArrar(request["actions"]);
                if (actions != null)
                {
                    permissionMgt.UpdateRoleActions(role_id, actions);
                }
            }
            catch (KMJXCException kex)
            {
                message.Status = "failed";
                message.Message = kex.Message;
            }
            catch
            {
            }
            finally
            {

            }
            return message;
        }