Exemplo n.º 1
0
            public Task ConfigureToolbarAsync(IToolbarConfigurationContext context)
            {
                if (context.Toolbar.Name != StandardToolbars.Main)
                {
                    return(Task.CompletedTask);
                }

                context.Toolbar.Items.Add(new ToolbarItem(typeof(MyComponent1), requiredPermissionName: "MyComponent1"));
                context.Toolbar.Items.Add(new ToolbarItem(typeof(MyComponent2), requiredPermissionName: "MyComponent2"));

                return(Task.CompletedTask);
            }
        public virtual async Task ConfigureToolbarAsync(IToolbarConfigurationContext context)
        {
            if (context.Toolbar.Name != StandardToolbars.Main)
            {
                return;
            }

            if (await context.IsGrantedAsync(
                    PrivateMessagingPermissions.PrivateMessageNotifications.Default))
            {
                context.Toolbar.Items.Insert(0, new ToolbarItem(typeof(PmNotificationViewComponent)));
            }
        }
Exemplo n.º 3
0
    public virtual Task ConfigureToolbarAsync(IToolbarConfigurationContext context)
    {
        if (context.Toolbar.Name != StandardToolbars.Main)
        {
            return(Task.CompletedTask);
        }

        if (!context.ServiceProvider.GetRequiredService <ICurrentUser>().IsAuthenticated)
        {
            context.Toolbar.Items.Add(new ToolbarItem(typeof(LoginLinkViewComponent)));
        }

        return(Task.CompletedTask);
    }
Exemplo n.º 4
0
        public virtual async Task ConfigureToolbarAsync(IToolbarConfigurationContext context)
        {
            if (context.Toolbar.Name != StandardToolbars.Main)
            {
                return;
            }

            var authorizationService = context.ServiceProvider.GetService <IAuthorizationService>();

            if (await authorizationService.IsGrantedAsync(
                    PrivateMessagingPermissions.PrivateMessageNotifications.Default))
            {
                context.Toolbar.Items.Insert(0, new ToolbarItem(typeof(PmNotificationViewComponent)));
            }
        }
Exemplo n.º 5
0
        public Task ConfigureToolbarAsync(IToolbarConfigurationContext context)
        {
            if (context.Toolbar.Name != StandardToolbars.Main)
            {
                return(Task.CompletedTask);
            }

            //TODO: Currently disabled!
            //if (!context.ServiceProvider.GetRequiredService<ICurrentUser>().IsAuthenticated)
            //{
            //    context.Toolbar.Items.Add(new ToolbarItem(typeof(UserLoginLinkViewComponent)));
            //}

            return(Task.CompletedTask);
        }
        public Task ConfigureToolbarAsync(IToolbarConfigurationContext context)
        {
            if (context.Toolbar.Name == StandardToolbars.Main)
            {
                //TODO: Can we find a different way to understand if authentication was configured or not?
                var authenticationStateProvider = context.ServiceProvider
                                                  .GetService <AuthenticationStateProvider>();

                if (authenticationStateProvider != null)
                {
                    context.Toolbar.Items.Insert(0, new ToolbarItem(typeof(NotificationReminder)));
                }
            }

            return(Task.CompletedTask);
        }
Exemplo n.º 7
0
        public Task ConfigureToolbarAsync(IToolbarConfigurationContext context)
        {
            if (context.Toolbar.Name != StandardToolbars.Main)
            {
                return(Task.CompletedTask);
            }

            // Remove the login item.
            context.Toolbar.Items.RemoveAll(x => x.ComponentType == typeof(LoginDisplay));

            context.Toolbar.Items.Insert(0, new ToolbarItem(typeof(Logs)));

            context.Toolbar.Items.Add(new ToolbarItem(typeof(SolutionSwitch)));

            return(Task.CompletedTask);
        }
Exemplo n.º 8
0
    public Task ConfigureToolbarAsync(IToolbarConfigurationContext context)
    {
        if (context.Toolbar.Name == StandardToolbars.Main)
        {
            context.Toolbar.Items.Add(new ToolbarItem(typeof(LanguageSwitch)));

            //TODO: Can we find a different way to understand if authentication was configured or not?
            var authenticationStateProvider = context.ServiceProvider
                                              .GetService <AuthenticationStateProvider>();

            if (authenticationStateProvider != null)
            {
                context.Toolbar.Items.Add(new ToolbarItem(typeof(LoginDisplay)));
            }
        }

        return(Task.CompletedTask);
    }