예제 #1
0
        public static BaseModule GetModule(string id)
        {
            BaseService.CheckLoginAndLicense();
            id = id.Replace("bitModule", "");
            id = id.Replace("bitEditor", "");
            BaseModule mod = BaseModule.GetById <BaseModule>(new Guid(id));

            if (mod.HasAutorisation)
            {
                BitAutorisationService.AutorisationClient client = BitAutorisationServiceHelper.GetClient();
                BitplateUserGroup[] usergroups = client.GetUserGroupsByObjectPermission(mod.ID);
                mod.AutorizedBitplateUserGroups = usergroups;

                BitplateUser[] users = client.GetUsersByObjectPermission(mod.ID);
                mod.AutorizedBitplateUsers = users;
                if (!mod.IsAutorized(SessionObject.CurrentBitplateUser))
                {
                    throw new Exception("U heeft geen rechten voor deze module");
                }
            }
            mod = mod.ConvertToType();
            //if (mod.SelectGroup != null && mod.SelectGroup != "")
            //{
            //    DataGroup dataGroup = BaseObject.GetById<DataGroup>(Guid.Parse(mod.SelectGroup));
            //    if (dataGroup != null)
            //    {
            //        mod.SelectGroupPath = dataGroup.DataCollection.Name + "/" + dataGroup.GetCompletePath(); //FindDataGroupBasePath(Guid.Parse(mod.SelectGroup));
            //    }
            //}
            return(mod);
        }
예제 #2
0
        public static string GetModuleContent(string id, string mode)
        {
            BaseService.CheckLoginAndLicense();
            string returnValue = "";

            //id = id.Replace("bitModule", "");
            id = id.Replace("bitModule", "").Replace("_", "-");

            BaseModule module = (BaseModule)BaseDomainObject.GetById <BaseModule>(new Guid(id));

            module = module.ConvertToType();
            if (mode == "edit")
            {
                returnValue = module.Content;
                Uri    uri           = System.Web.HttpContext.Current.Request.UrlReferrer;
                string currentDomain = uri.GetLeftPart(UriPartial.Authority);
                if (SessionObject.CurrentSite.DomainName != currentDomain)
                {
                    returnValue = HtmlHelper.ReplaceImageSources(returnValue, ModeEnum.Edit, SessionObject.CurrentSite);
                }
                if (module.HasAutorisation)
                {
                    BitAutorisationService.AutorisationClient client = BitAutorisationServiceHelper.GetClient();
                    BitplateUserGroup[] usergroups = client.GetUserGroupsByObjectPermission(module.ID);
                    module.AutorizedBitplateUserGroups = usergroups;

                    BitplateUser[] users = client.GetUsersByObjectPermission(module.ID);
                    module.AutorizedBitplateUsers = users;
                    if (!module.IsAutorized(SessionObject.CurrentBitplateUser))
                    {
                        throw new Exception("U heeft geen rechten voor deze module");
                    }
                }
            }
            else
            {
                //module.LoadPropsFromXmlFile();
                returnValue = new ModuleService().GetUserControlContent(module);
            }


            return(returnValue);
        }
예제 #3
0
        public static License LoadLicense()
        {
            string licenseCode = "";

            if (CurrentSite != null)
            {
                licenseCode = CurrentSite.LicenceCode;
            }
            string serverName  = Environment.MachineName;
            string ipAddress   = HttpContext.Current.Request.ServerVariables["remote_host"];
            string relativeUrl = HttpContext.Current.Request.Url.PathAndQuery;
            string completeUrl = HttpContext.Current.Request.Url.ToString();
            string domainName  = completeUrl.Replace(relativeUrl, "");

            BitSite.BitAutorisationService.AutorisationClient client = BitAutorisationServiceHelper.GetClient();
            License returnValue = client.LoadLicense(licenseCode, serverName, domainName);

            client.Close();
            if (returnValue != null)
            {
                CurrentSite.IsValidLicense = true;
            }
            return(returnValue);
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.CheckLogin();
            base.CheckPermissions(FunctionalityEnum.LicenseManagement, checkLicenseAlso: false);

            License test = null;

            if (Request.QueryString["Referer"] != null)
            {
                this.BackLink.HRef = Request.QueryString["Referer"];
            }

            BitSite.BitAutorisationService.AutorisationClient client = BitAutorisationServiceHelper.GetClient();
            Functionality[] functionalities = client.GetFunctionalities(SessionObject.CurrentBitplateUser);

            LiteralPermissions.Text = BuildFunctionsTree2("License");

            //vullen van standaard permissionsets;
            string js = @"<script type='text/javascript'>";

            js += GetJavascriptDefaultsArray(client, (int)LicenceTypeEnum.BitplateLite);
            js += GetJavascriptDefaultsArray(client, (int)LicenceTypeEnum.BitplateStandard);
            js += GetJavascriptDefaultsArray(client, (int)LicenceTypeEnum.BitplateCorporate);
            js += GetJavascriptDefaultsArray(client, (int)LicenceTypeEnum.BitplateEnteprise);
            js += GetJavascriptDefaultsArray(client, (int)LicenceTypeEnum.BitplateCustom);
            js += GetJavascriptDefaultsArray(client, (int)NewsletterLicenceTypeEnum.BitnewsletterLite);
            js += GetJavascriptDefaultsArray(client, (int)NewsletterLicenceTypeEnum.BitnewsletterCorporate);
            js += GetJavascriptDefaultsArray(client, (int)NewsletterLicenceTypeEnum.BitnewsletterCustom);
            js += GetJavascriptDefaultsArray(client, (int)WebshopLicenceTypeEnum.BitshopLite);
            js += GetJavascriptDefaultsArray(client, (int)WebshopLicenceTypeEnum.BitshopCorporate);
            js += GetJavascriptDefaultsArray(client, (int)WebshopLicenceTypeEnum.BitshopXtra);
            js += GetJavascriptDefaultsArray(client, (int)WebshopLicenceTypeEnum.BitshopCustom);
            js += "</script>";
            DefaultPermissionSets.Text = js;
            client.Close();
        }
예제 #5
0
        public static string SaveModule(BaseModule module, string pageid)
        {
            string Url = HttpContext.Current.Request.UrlReferrer.ToString();

            BaseService.CheckLoginAndLicense();
            module.Site = SessionObject.CurrentSite;
            if (module.IsVisibleOnAllPages)
            {
                module.Template = null;
                module.Page     = null;
            }
            else if (module.IsVisibleOnAllPagesInLayout)
            {
                if (Url.ToLower().Contains("/newsletters"))
                {
                    Newsletter newletter = BaseObject.GetById <Newsletter>(new Guid(pageid));
                    module.Template = newletter.Template;
                }
                else
                {
                    CmsPage page = BaseObject.GetById <CmsPage>(new Guid(pageid));
                    module.Template = page.Template;
                }
            }
            else
            {
                if (Url.ToLower().Contains("/newsletters"))
                {
                    module.Newsletter    = new Newsletter();
                    module.Newsletter.ID = new Guid(pageid);
                }
                else
                {
                    module.Page    = new CmsPage();
                    module.Page.ID = new Guid(pageid);
                }
            }
            module.Save();
            //SetUnpublishedItem(module);
            module = module.ConvertToType();

            //lijst van ObjectPermissions wordt hier alleen als drager gebruikt.
            //in de licentieserver wordt deze lijst weer gesplitst en in 2 tabellen gezet
            BaseCollection <ObjectPermission> objPermissions = module.GetObjectPermissions4LicenseServer();

            if (objPermissions.Count > 0)
            {
                BitAutorisationService.AutorisationClient client = BitAutorisationServiceHelper.GetClient();
                client.SaveObjectPermissions(objPermissions);
            }
            //publiceren van pagina('s)
            PublishModule(module);
            PublishDependentPages(module);

            //Experimenteel caching reset
            //if (module.Page != null) BitCaching.RemoveItemFromCache(module.Page.ID.ToString());

            string returnValue = new ModuleService().GetUserControlContent(module);

            return(returnValue);
        }