Example #1
0
        public async Task <IActionResult> RightsEdit(FrontContentRightsUpdateGet RightsEdit)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var FrontContentRightsUpdateGetWithErrorMessage = await _client.PostProtectedAsync <FrontContentRightsUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/FrontContent/RightsUpdate", RightsEdit, token);

            if (FrontContentRightsUpdateGetWithErrorMessage.ErrorMessages.Count > 0)
            {
                var AllStuff = await _loadViewBagModel.ViewBagLoad(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), token, _hostingEnv.EnvironmentName, _configuration, false, 0, "");

                AllStuff.ErrorMessages = FrontContentRightsUpdateGetWithErrorMessage.ErrorMessages;
                ViewBag.AllStuff       = AllStuff;


                //ViewBag.Favorites = await _client.GetProtectedAsync<List<MVCFavoriteMenu>>($"{_configuration["APIUrl"]}api/MVCFavorite/Menu", token);
                //ViewBag.FavoriteGroupList = await _client.GetProtectedAsync<List<MVCFavoriteGroupList>>($"{_configuration["APIUrl"]}api/MVCFavorite/GroupList", token);
                //ViewBag.UITerms = await _client.GetProtectedAsync<List<UITermLanguageCustomizationList>>($"{_configuration["APIUrl"]}api/MVC/FrontContent/RightsEdit", token);
                //ViewBag.ErrorMessages = FrontContentRightsUpdateGetWithErrorMessage.ErrorMessages;
                return(View(FrontContentRightsUpdateGetWithErrorMessage.FrontContentRights));
            }


            return(RedirectToAction("ShowContent", new { id = RightsEdit.ContentId }));
        }
        public async Task <IActionResult> RightsUpdate(FrontContentRightsUpdateGet FrontContentRights)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            FrontContentRights.UserId = CurrentUser.Id;
            var ErrorMessages = new List <ErrorMessage>();

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                ErrorMessages = await _frontContentProvider.RightsUpdatePostCheck(FrontContentRights);

                if (ErrorMessages.Count == 0)
                {
                    _frontContentProvider.RightsUpdatePost(FrontContentRights);
                }
                FrontContentRightsUpdateGetWithErrorMessages FrontContentRightsUpdateGetWithErrorMessage = new FrontContentRightsUpdateGetWithErrorMessages {
                    FrontContentRights = FrontContentRights, ErrorMessages = ErrorMessages
                };
                return(Ok(FrontContentRightsUpdateGetWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            FrontContentRightsUpdateGetWithErrorMessages FrontContentRightsUpdateGetWithNoRights = new FrontContentRightsUpdateGetWithErrorMessages {
                FrontContentRights = FrontContentRights, ErrorMessages = ErrorMessages
            };

            return(Ok(FrontContentRightsUpdateGetWithNoRights));
        }
Example #3
0
        public bool RightsUpdatePost(FrontContentRightsUpdateGet FrontContentRights)
        {
            string usp = "usp_FrontContentRightsUpdatePost @ContentId  " +
                         " , @IsRelationBasedEdit " +
                         " , @IsRelationBasedRead " +
                         " , @IsProjectBasedEdit  " +
                         " , @IsProjectBasedEditSub  " +
                         " , @IsProjectBasedEditParent  " +
                         " , @IsOrganizationBasedEdit  " +
                         " , @IsOrganizationBasedEditSub  " +
                         " , @IsOrganizationBasedEditParent  " +
                         " , @IsProjectBasedRead  " +
                         " , @IsProjectBasedReadSub  " +
                         " , @IsProjectBasedReadParent  " +
                         " , @IsOrganizationBasedRead  " +
                         " , @IsOrganizationBasedReadSub  " +
                         " , @IsOrganizationBasedReadParent  " +
                         " , @OwnerId  " +
                         " , @UserId ";

            _sqlDataAccess.SaveData <FrontContentRightsUpdateGet>(usp, FrontContentRights);
            return(true);
        }
Example #4
0
        public async Task <List <ErrorMessage> > RightsUpdatePostCheck(FrontContentRightsUpdateGet FrontContentRights)
        {
            string usp = "usp_FrontContentRightsUpdatePostCheck @ContentId  " +
                         " , @IsRelationBasedEdit " +
                         " , @IsRelationBasedRead " +
                         " , @IsProjectBasedEdit  " +
                         " , @IsProjectBasedEditSub  " +
                         " , @IsProjectBasedEditParent  " +
                         " , @IsOrganizationBasedEdit  " +
                         " , @IsOrganizationBasedEditSub  " +
                         " , @IsOrganizationBasedEditParent  " +
                         " , @IsProjectBasedRead  " +
                         " , @IsProjectBasedReadSub  " +
                         " , @IsProjectBasedReadParent  " +
                         " , @IsOrganizationBasedRead  " +
                         " , @IsOrganizationBasedReadSub  " +
                         " , @IsOrganizationBasedReadParent  " +
                         " , @OwnerId  " +
                         " , @UserId ";
            var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, FrontContentRights);

            return(ErrorMessages);
        }