Exemple #1
0
        public void Initialize(IAuthorizationService authorizationService)
        {
            // If site is currently in Install mode, don't do anything.
            if (_adminConfig.Installer.Mode == InstallationMode.Install)
                return;

            // Dynamically add authorization rule for admin site.
            List<string> authorizedRoles = new List<string>();
            foreach (AuthorizedRoleElement authorizedRoleElement in _adminConfig.AuthorizedRoles)
                authorizedRoles.Add(authorizedRoleElement.Role);
            authorizationService.AddRule(_adminConfig.Path,
                null, authorizedRoles, new[] { "*" }, null);
        }