public CmsTemplate GetTemplate(string id, int type) { BaseService.CheckLoginAndLicense(); CmsTemplate template = CmsTemplate.New(); //TODO: NewsletterTemplate service. 0 = PageTemplate & 1 = NewsletterTemplate if (type == 1) { //template.Content = template.Content.Replace("[HEAD]", ""); } if (id != null) { template = BaseObject.GetById <CmsTemplate>(new Guid(id)); if (template.HasAutorisation) { //BitAutorisationService.AutorisationClient client = BitMetaServerServicesHelper.GetClient(); //BitplateUserGroup[] usergroups = client.GetUserGroupsByObjectPermission(template.ID); //template.AutorizedBitplateUserGroups = usergroups; //BitplateUser[] users = client.GetUsersByObjectPermission(template.ID); //template.AutorizedBitplateUsers = users; if (!template.IsAutorized(SessionObject.CurrentBitplateUser)) { throw new Exception("U heeft geen rechten voor deze template"); } } } else { template.Site = SessionObject.CurrentSite; } return(template); }
public CmsTemplate GetTemplateIncludeHeader(string id) { BaseService.CheckLoginAndLicense(); CmsTemplate template = CmsTemplate.New(); if (id != null) { template = BaseObject.GetById <CmsTemplate>(new Guid(id)); if (template.HasAutorisation) { //BitAutorisationService.AutorisationClient client = BitAutorisationServiceHelper.GetClient(); //BitplateUserGroup[] usergroups = client.GetUserGroupsByObjectPermission(template.ID); //template.AutorizedBitplateUserGroups = usergroups; //BitplateUser[] users = client.GetUsersByObjectPermission(template.ID); //template.AutorizedBitplateUsers = users; if (!template.IsAutorized(SessionObject.CurrentBitplateUser)) { throw new Exception("U heeft geen rechten voor deze template"); } } } else { template.Site = SessionObject.CurrentSite; } string tmpHead = ""; foreach (CmsScript script in template.Scripts) { tmpHead += script.GetTag() + "\n\r"; } template.Content = template.Content.Replace("[HEAD]", tmpHead).Replace("[SCRIPTS]", ""); return(template); }