public virtual ActionResult ApplyPagePermissions(PermissionsModel model)
        {
            Page page = pageService.Find(model.EntityId);

            if (page != null)
            {
                if (permissionService.IsAllowed((Int32)PageOperations.Permissions, this.CorePrincipal(), typeof(Page), page.Id, IsPageOwner(page), PermissionOperationLevel.Object))
                {
                    permissionHelper.ApplyPermissions(model, typeof(Page));
                }
                if (permissionService.IsAllowed((Int32)PageOperations.Permissions, this.CorePrincipal(), typeof(Page), page.Id, IsPageOwner(page), PermissionOperationLevel.Object))
                {
                    return(Content(Url.Action(MVC.Pages.Show(page.Url))));
                }
            }

            return(Content(Url.Action(MVC.Home.Index())));
        }
        public virtual ActionResult ApplyPermissions(PermissionsModel model)
        {
            var form = _formsService.Find(model.EntityId);

            if (form != null)
            {
                if (_permissionService.IsAllowed((Int32)FormOperations.Permissions, this.CorePrincipal(), typeof(Form), form.Id, IsFormOwner(form), PermissionOperationLevel.Object))
                {
                    _permissionsHelper.ApplyPermissions(model, typeof(Form));
                }
                if (_permissionService.IsAllowed((Int32)FormOperations.Permissions, this.CorePrincipal(), typeof(Form), form.Id, IsFormOwner(form), PermissionOperationLevel.Object))
                {
                    return(Content(Url.Action("ShowPermissions", "Forms", new { formId = form.Id })));
                }
            }

            return(Content(Url.Action("ShowAll")));
        }
예제 #3
0
        public virtual ActionResult ApplyPermissions(PermissionsModel model)
        {
            var form = formsService.Find(model.EntityId);

            if (form != null)
            {
                if (permissionService.IsAllowed((Int32)FormOperations.Permissions, this.CorePrincipal(), typeof(Form), form.Id, IsFormOwner(form), PermissionOperationLevel.Object))
                {
                    permissionsHelper.ApplyPermissions(model, typeof(Form));
                }
                if (permissionService.IsAllowed((Int32)FormOperations.Permissions, this.CorePrincipal(), typeof(Form), form.Id, IsFormOwner(form), PermissionOperationLevel.Object))
                {
                    Success(HttpContext.Translate("Messages.PermitionsSuccess", ResourceHelper.GetControllerScope(this)) /*"Successfully apply permissions."*/);
                    return(Content(Url.Action("ShowPermissions", "Forms", new { formId = form.Id })));
                }
                Error(String.Format(HttpContext.Translate("Messages.PermitionsUnSuccess", ResourceHelper.GetControllerScope(this)) /*"Could not apply permissions to Form Entity: {0}"*/, model.EntityId));
            }
            Error(String.Format(HttpContext.Translate("Messages.NotFoundEntity", ResourceHelper.GetControllerScope(this)) /*"Could not found Form Entity: {0}"*/, model.EntityId));
            return(Content(Url.Action("ShowAll")));
        }
        public virtual ActionResult ApplyPermissions(PermissionsModel model)
        {
            var category = categoryService.Find(model.EntityId);

            if (category != null)
            {
                if (permissionService.IsAllowed((Int32)CategoryOperations.Permissions, this.CorePrincipal(), typeof(WebContentCategory), category.Id, IsCategoryOwner(category), PermissionOperationLevel.Object))
                {
                    permissionsHelper.ApplyPermissions(model, typeof(WebContentCategory));
                }
                if (permissionService.IsAllowed((Int32)CategoryOperations.Permissions, this.CorePrincipal(), typeof(WebContentCategory), category.Id, IsCategoryOwner(category), PermissionOperationLevel.Object))
                {
                    Success(HttpContext.Translate("Messages.PermitionsSuccess", ResourceHelper.GetControllerScope(this)));
                    return(Content(Url.Action("ShowPermissions", "WebContentCategory", new { categoryId = category.Id })));
                }
                Error(String.Format(HttpContext.Translate("Messages.PermitionsUnSuccess", ResourceHelper.GetControllerScope(this)), model.EntityId));
            }
            Error(String.Format(HttpContext.Translate("Messages.NotFoundEntity", ResourceHelper.GetControllerScope(this)), model.EntityId));

            return(Content(Url.Action("Show")));
        }
예제 #5
0
        public virtual ActionResult ApplyPermissions(PermissionsModel model)
        {
            var article = articleService.Find(model.EntityId);

            if (article != null)
            {
                if (permissionService.IsAllowed((Int32)ArticleOperations.Permissions, this.CorePrincipal(), typeof(Article), article.Id, IsArticleOwner(article), PermissionOperationLevel.Object))
                {
                    permissionsHelper.ApplyPermissions(model, typeof(Article));
                }
                if (permissionService.IsAllowed((Int32)ArticleOperations.Permissions, this.CorePrincipal(), typeof(Article), article.Id, IsArticleOwner(article), PermissionOperationLevel.Object))
                {
                    Success(HttpContext.Translate("Messages.PermitionsSuccess", ResourceHelper.GetControllerScope(this)));
                    return(Content(Url.Action("ShowPermissions", "Article", new { articleId = article.Id })));
                }
                Error(String.Format(HttpContext.Translate("Messages.PermitionsUnSuccess", ResourceHelper.GetControllerScope(this)), model.EntityId));
            }
            Error(String.Format(HttpContext.Translate("Messages.NotFoundEntity", ResourceHelper.GetControllerScope(this)), model.EntityId));

            return(Content(Url.Action("Show")));
        }