예제 #1
0
        public Task <IActionResult> Index()
        {
            // Ensure default shell, We cannot sign-up from tenants
            if (!_shellSettings.IsDefaultShell())
            {
                return(Task.FromResult((IActionResult)Unauthorized()));
            }

            // Return view
            return(Task.FromResult((IActionResult)View()));
        }
예제 #2
0
파일: AdminMenu.cs 프로젝트: radtek/Plato
        public void BuildNavigation(string name, INavigationBuilder builder)
        {
            if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            // Ensure host
            if (!_shellSettings.IsDefaultShell())
            {
                return;
            }

            builder
            .Add(T["Tenants"], int.MaxValue - 8, tenants => tenants
                 .IconCss("fal fa-browser")
                 .Add(T["Manage"], 3, manage => manage
                      .Action("Index", "Admin", "Plato.Tenants")
                      .Permission(Permissions.ManageTenants)
                      .LocalNav())
                 .Add(T["Add"], 4, create => create
                      .Action("Create", "Admin", "Plato.Tenants")
                      .Permission(Permissions.AddTenants)
                      .LocalNav())
                 .Add(T["Settings"], 5, settings => settings
                      .Action("Settings", "Admin", "Plato.Tenants")
                      .Permission(Permissions.EditSettings)
                      .LocalNav())
                 );
        }
예제 #3
0
        // --------------
        // Index
        // --------------

        public async Task <IActionResult> Index(TenantIndexOptions opts)
        {
            // Ensure we have permission
            if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageTenants))
            {
                return(Unauthorized());
            }

            // Ensure host
            if (!_shellSettings.IsDefaultShell())
            {
                return(Unauthorized());
            }

            if (opts == null)
            {
                opts = new TenantIndexOptions();
            }

            // Configure breadcrumb
            _breadCrumbManager.Configure(builder =>
            {
                builder.Add(S["Home"], home => home
                            .Action("Index", "Admin", "Plato.Admin")
                            .LocalNav()
                            ).Add(S["Tenants"]);
            });

            // Build view model
            var viewModel = new TenantIndexViewModel()
            {
                Options = opts
            };

            // Add view model to context
            this.HttpContext.Items[typeof(TenantIndexViewModel)] = viewModel;

            // Return view
            return(View((LayoutViewModel)await _viewProvider.ProvideIndexAsync(new ShellSettings(), this)));
        }