Exemplo n.º 1
0
        protected override async Task OnParametersSetAsync()
        {
            Blogs = new BlogsModel(NodeService)
            {
                NodeSearch = new NodeSearch()
                {
                    Module  = Constants.BlogsModule,
                    Type    = Constants.BlogType,
                    OrderBy = new string[]
                    {
                        OrderBy.Title
                    }
                }
            };
            await Blogs.InitAsync();

            var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId();

            CanAddBlog = await SecurityService.AllowedAsync(
                loggedInUserId,
                null,
                Constants.BlogsModule,
                Constants.BlogType,
                Actions.Add
                );
        }
Exemplo n.º 2
0
        protected override async Task OnParametersSetAsync()
        {
            var configSearch = new NodeSearch()
            {
                Module = Constants.BlogsModule,
                Type   = Constants.ConfigType
            };
            var configNodes = (await NodeService.GetAsync(configSearch, 0));

            if (configNodes.Length > 0)
            {
                Config = configNodes[0];
            }
            Blogs = new BlogsModel(NodeService)
            {
                NodeSearch = new NodeSearch()
                {
                    Module          = Constants.BlogsModule,
                    Type            = Constants.BlogType,
                    OrderBy         = $"{OrderBy.Title}",
                    TruncateContent = 140
                }
            };
            await Blogs.InitAsync();

            var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId();

            CanEditConfig = await SecurityService.AllowedAsync(
                loggedInUserId,
                null,
                Constants.BlogsModule,
                Constants.ConfigType,
                Actions.Edit
                );

            CanAddBlog = await SecurityService.AllowedAsync(
                loggedInUserId,
                null,
                Constants.BlogsModule,
                Constants.BlogType,
                Actions.Add
                );
        }