예제 #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);
        }