コード例 #1
0
 public RegisterController(UIUserProvider userProvider, UIRoleProvider roleProvider, UISignInManager signInManager, IContentSecurityRepository contentSecurityRepository)
 {
     _userProvider              = userProvider;
     _roleProvider              = roleProvider;
     _signInManager             = signInManager;
     _contentSecurityRepository = contentSecurityRepository;
 }
 public AdminRegistrationController()
 {
     _UIUserProvider            = ServiceLocator.Current.GetInstance <UIUserProvider>();;
     _UIRoleProvider            = ServiceLocator.Current.GetInstance <UIRoleProvider>();
     _UISignInManager           = ServiceLocator.Current.GetInstance <UISignInManager>();
     _contentSecurityRepository = ServiceLocator.Current.GetInstance <IContentSecurityRepository>();
 }
コード例 #3
0
        public void Initialize(InitializationEngine context)
        {
            _contentRootService        = ServiceLocator.Current.GetInstance <ContentRootService>();
            _contentSecurityRepository = ServiceLocator.Current.GetInstance <IContentSecurityRepository>();

            InitializeGoogleContactsComponent(context);
        }
コード例 #4
0
        public ContentApprovalsManagerPageController(
            IApprovalDefinitionRepository repoDefinitions,
            IContentRepository repoContent,
            IApprovalRepository repoApprovals,
            IApprovalEngine engine,
            UIRoleProvider roles,
            UIUserProvider users,
            IContentSecurityRepository repoSecurity)
        {
            this.repoDefinitions = repoDefinitions;
            this.repoContent     = repoContent;
            this.repoApprovals   = repoApprovals;
            this.engine          = engine;

            // if the editors role does not exist, create it and assign access rights
            if (!roles.RoleExists(editors))
            {
                roles.CreateRole(editors);

                var permissions = repoSecurity.Get(ContentReference.RootPage).CreateWritableClone() as IContentSecurityDescriptor;
                permissions.AddEntry(new AccessControlEntry(editors,
                                                            AccessLevel.Create | AccessLevel.Edit | AccessLevel.Delete | AccessLevel.Read | AccessLevel.Publish));
                repoSecurity.Save(ContentReference.RootPage, permissions, SecuritySaveType.Replace);
            }

            // create three users and add them to roles

            UIUserCreateStatus   status;
            IEnumerable <string> errors = Enumerable.Empty <string>();

            if (users.GetUser(userName1) == null)
            {
                users.CreateUser(
                    userName1, password,
                    email: userName1.ToLower() + emailBase,
                    passwordQuestion: null, passwordAnswer: null,
                    isApproved: true, status: out status, errors: out errors);

                roles.AddUserToRoles(userName1, new string[] { admins });
            }

            if (users.GetUser(userName2) == null)
            {
                users.CreateUser(
                    userName2, password, userName2.ToLower() + emailBase,
                    null, null, true, out status, out errors);

                roles.AddUserToRoles(userName2, new string[] { editors });
            }

            if (users.GetUser(userName3) == null)
            {
                users.CreateUser(
                    userName3, password, userName3.ToLower() + emailBase,
                    null, null, true, out status, out errors);

                roles.AddUserToRoles(userName3, new string[] { editors });
            }
        }
コード例 #5
0
 public ResetAdminController(IContentSecurityRepository securityRepository,
                             IPageCriteriaQueryService pageFinder,
                             UIUserProvider users, UIRoleProvider roles)
 {
     this.securityRepository = securityRepository;
     this.users = users;
     this.roles = roles;
 }
コード例 #6
0
 public void Initialize(InitializationEngine context)
 {
     if (!initialized)
     {
         contentLoader             = context.Locate.Advanced.GetInstance <IContentLoader>();
         contentSecurityRepository = context.Locate.Advanced.GetInstance <IContentSecurityRepository>();
         contentSecurityRepository.ContentSecuritySaving += ContentSecurityRepository_ContentSecuritySaving;
         initialized = true;
     }
 }
コード例 #7
0
 public UserManagementService(IAccountRepository accountRepository,
                              IContentSecurityRepository contentSecurityRepository,
                              IUserTermsOfUseRepository userTermsOfUseRepository,
                              IOrganizationUserRepository orgUserRepo,
                              ITokenGenerator tokenGenerator)
 {
     _accountRepository         = accountRepository;
     _contentSecurityRepository = contentSecurityRepository;
     _userTermsOfUseRepository  = userTermsOfUseRepository;
     _orgUserRepo    = orgUserRepo;
     _tokenGenerator = tokenGenerator;
 }
コード例 #8
0
        private void AddUsersAndRoles(IContentSecurityRepository securityRepository)
        {
            var password = "******";

            AddRole("WebAdmins", AccessLevel.FullAccess, securityRepository);
            AddRole("WebEditors", AccessLevel.FullAccess ^ AccessLevel.Administer, securityRepository);

            AddUser("cmsadmin", "Administrator Administrator", password, new[] { "WebEditors", "WebAdmins" });
            AddUser("abbie", "Abbie Andrea", password, new[] { "WebEditors", "WebAdmins" });
            AddUser("eddie", "Eddie Elridge", password, new[] { "WebEditors" });
            AddUser("erin", "Erin Ehrhardt", password, new[] { "WebEditors" });
            AddUser("reid", "Reid Rezac", password, new[] { "WebEditors" });
        }
コード例 #9
0
        public void Initialize(InitializationEngine context)
        {
            IContentEvents events = context.Locate.Advanced.GetInstance <IContentEvents>();

            events.PublishedContent += IndexingEvents.UpdateIndex;
            events.DeletingContent  += IndexingEvents.DeleteFromIndex;
            events.MovedContent     += IndexingEvents.UpdateIndex;
            events.SavedContent     += IndexingEvents.UpdateIndex;

            IContentSecurityRepository contentSecurityRepository = context.Locate.Advanced.GetInstance <IContentSecurityRepository>();

            contentSecurityRepository.ContentSecuritySaved += IndexingEvents.UpdateIndex;
        }
コード例 #10
0
        private void AddRole(string roleName, AccessLevel accessLevel, IContentSecurityRepository securityRepository)
        {
            if (!UIRoleProvider.RoleExists(roleName))
            {
                UIRoleProvider.CreateRole(roleName);

                var permissions = (IContentSecurityDescriptor)securityRepository.Get(ContentReference.RootPage).CreateWritableClone();
                permissions.AddEntry(new AccessControlEntry(roleName, accessLevel));

                securityRepository.Save(ContentReference.RootPage, permissions, SecuritySaveType.Replace);
                securityRepository.Save(ContentReference.WasteBasket, permissions, SecuritySaveType.Replace);
            }
        }
コード例 #11
0
        private void AddUsersAndRoles(IContentSecurityRepository securityRepository)
        {
            var password = "******";

            AddRole("WebAdmins", AccessLevel.FullAccess, securityRepository);
            AddRole("WebEditors", AccessLevel.FullAccess ^ AccessLevel.Administer, securityRepository);

            AddUser("cmsadmin", "Administrator Administrator", password, new[] { "WebEditors", "WebAdmins" });
            AddUser("alfred", "Alfred Andersson", password, new[] { "WebEditors", "WebAdmins" });
            AddUser("emil", "Emil Svensson", password, new[] { "WebEditors" });
            AddUser("ida", "Ida Svensson", password, new[] { "WebEditors" });
            AddUser("lina", "Lina Lindström", password, new[] { "WebEditors" });
        }
コード例 #12
0
        public void Initialize(InitializationEngine context)
        {
            Indexing.Instance.ExcludeType <SynonymBackupFile>();
            Indexing.Instance.ExcludeType <SynonymBackupFileFolder>();

            IContentEvents events = ServiceLocator.Current.GetInstance <IContentEvents>();

            events.PublishedContent += IndexingEvents.UpdateIndex;
            events.DeletingContent  += IndexingEvents.DeleteFromIndex;
            events.MovedContent     += IndexingEvents.UpdateIndex;

            IContentSecurityRepository contentSecurityRepository = context.Locate.Advanced.GetInstance <IContentSecurityRepository>();

            contentSecurityRepository.ContentSecuritySaved += IndexingEvents.UpdateIndex;
        }
コード例 #13
0
        public void Uninitialize(InitializationEngine context)
        {
            if (!LuceneConfiguration.Active)
            {
                return;
            }
            IContentEvents             contentEvents      = context.Locate.ContentEvents();
            IContentSecurityRepository securityRepository = context.Locate.ContentSecurityRepository();

            contentEvents.PublishedContent          -= new EventHandler <ContentEventArgs>(PublishContent);
            contentEvents.MovedContent              -= new EventHandler <ContentEventArgs>(MovedContent);
            contentEvents.DeletedContent            -= new EventHandler <DeleteContentEventArgs>(DeleteContent);
            contentEvents.DeletedContentLanguage    -= new EventHandler <ContentEventArgs>(DeleteContentLanguage);
            securityRepository.ContentSecuritySaved -= new EventHandler <ContentSecurityEventArg>(UpdateSecurity);
        }
コード例 #14
0
        private void SetAccessControlListForContent(ContentReference reference, string role, AccessLevel level)
        {
            IContentSecurityRepository contentSecurityRepository = ServiceLocator.Current.GetInstance <IContentSecurityRepository>();

            IContentSecurityDescriptor permissions = contentSecurityRepository.Get(reference).CreateWritableClone() as IContentSecurityDescriptor;

            //Not IContentSecurityDescriptor
            if (permissions == null)
            {
                return;
            }

            permissions.AddEntry(new AccessControlEntry(role, level));

            contentSecurityRepository.Save(reference, permissions, SecuritySaveType.Replace);
        }
        public void Initialize(InitializationEngine context)
        {
            _contentEvents             = context.Locate.Advanced.GetInstance <IContentEvents>();
            _contentSecurityRepository = context.Locate.Advanced.GetInstance <IContentSecurityRepository>();
            _contentLoader             = context.Locate.Advanced.GetInstance <IContentLoader>();
            _contentCacheKeyCreator    = context.Locate.Advanced.GetInstance <IContentCacheKeyCreator>();
            _htmlCache = context.Locate.Advanced.GetInstance <IDistributedCache>();

            _contentEvents.CreatedContent    += ContentCreated;
            _contentEvents.MovedContent      += MovedContent;
            _contentEvents.PublishingContent += PublishingContent;
            _contentEvents.PublishedContent  += PublishedContent;
            _contentEvents.DeletedContent    += DeletedContent;

            _contentSecurityRepository.ContentSecuritySaved += ContentSecuritySaved;
        }
コード例 #16
0
        public void Initialize(InitializationEngine context)
        {
            System.Web.Mvc.ViewEngines.Engines.Add(new XhtmlStringViewEngine(new XhtmlStringRenderer(context.Locate.Advanced.GetInstance <IRenderingContextResolver>())));

            _htmlCache                 = context.Locate.Advanced.GetInstance <DefaultHtmlCache>();
            _contentEvents             = context.Locate.Advanced.GetInstance <IContentEvents>();
            _contentSecurityRepository = context.Locate.Advanced.GetInstance <IContentSecurityRepository>();
            _contentLoader             = context.Locate.Advanced.GetInstance <IContentLoader>();

            _contentEvents.CreatedContent    += ContentCreated;
            _contentEvents.MovedContent      += MovedContent;
            _contentEvents.PublishingContent += PublishingContent;
            _contentEvents.PublishedContent  += PublishedContent;
            _contentEvents.DeletedContent    += DeletedContent;

            _contentSecurityRepository.ContentSecuritySaved += ContentSecuritySaved;
        }
コード例 #17
0
        public void Initialize(InitializationEngine context)
        {
            if (!LuceneConfiguration.Active)
            {
                return;
            }
            IContentEvents             contentEvents      = context.Locate.ContentEvents();
            IContentSecurityRepository securityRepository = context.Locate.ContentSecurityRepository();

            contentEvents.PublishedContent          += new EventHandler <ContentEventArgs>(PublishContent);
            contentEvents.MovedContent              += new EventHandler <ContentEventArgs>(MovedContent);
            contentEvents.DeletedContent            += new EventHandler <DeleteContentEventArgs>(DeleteContent);
            contentEvents.DeletedContentLanguage    += new EventHandler <ContentEventArgs>(DeleteContentLanguage);
            securityRepository.ContentSecuritySaved += new EventHandler <ContentSecurityEventArg>(UpdateSecurity);
            _indexingHandler.Value.Init();
            _remoteContentIndexRepository.Value.Init();
            DoingHealthCheck();
        }
コード例 #18
0
 public RegisterController(IContentSecurityRepository securityRepository)
 {
     this.securityRepository = securityRepository;
 }
コード例 #19
0
 public FixScheduledJob(IContentLoader contentLoader, ReferenceConverter referenceConverter, IContentSecurityRepository contentSecurityRepository)
 {
     _contentLoader             = contentLoader;
     _referenceConverter        = referenceConverter;
     _contentSecurityRepository = contentSecurityRepository;
 }
コード例 #20
0
 /// <summary>
 /// DI Constructor
 /// </summary>
 /// <param name="contentSecurityRepository"></param>
 /// <param name="vulcanContentAncestorLoader"></param>
 public VulcanCmsIndexingModifier(IContentSecurityRepository contentSecurityRepository, IEnumerable <IVulcanContentAncestorLoader> vulcanContentAncestorLoader)
 {
     _contentSecurityDescriptor    = contentSecurityRepository;
     _vulcanContentAncestorLoaders = vulcanContentAncestorLoader;
 }