Exemple #1
0
        /// <exclude />
        public static void SetSerializedEntityTokens(Guid userGroupId, IEnumerable <string> serializedEntityTokens)
        {
            DataFacade.Delete <IUserGroupActivePerspective>(f => f.UserGroupId == userGroupId);

            foreach (string serializedEntityToken in serializedEntityTokens)
            {
                IUserGroupActivePerspective activePerspective = DataFacade.BuildNew <IUserGroupActivePerspective>();

                activePerspective.Id                    = Guid.NewGuid();
                activePerspective.UserGroupId           = userGroupId;
                activePerspective.SerializedEntityToken = serializedEntityToken;

                DataFacade.AddNew <IUserGroupActivePerspective>(activePerspective);
            }
        }
        public override IEnumerable <XElement> Install()
        {
            // Sitemap Perspective
            IUserGroupActivePerspective sitemapPerspective = DataFacade.BuildNew <IUserGroupActivePerspective>();
            var userGroup = DataFacade.GetData <IUserGroup>().FirstOrDefault(u => u.Name == "Administrator");

            if (userGroup != null)
            {
                sitemapPerspective.UserGroupId = userGroup.Id;
                EntityToken entityToken = new TreePerspectiveEntityToken("SitemapElement");
                sitemapPerspective.SerializedEntityToken = EntityTokenSerializer.Serialize(entityToken);
                sitemapPerspective.Id = Guid.NewGuid();
                DataFacade.AddNew(sitemapPerspective);
                LoggingService.LogInformation("ComposerExperience", string.Format("Access to the Sitemap Perspective granted for group {0}.", userGroup.Name));
            }

            FixDefaultLanguageUrlMapping();

            yield break;
        }