示例#1
0
        public IEnumerable <Webextendrecord> ImportExtensionsPartOne(byte[] zipFile)
        {
            var importObjectString = ZipClass.Decompress(zipFile);
            var webextendrecords   = JsonConvert.DeserializeObject <IEnumerable <Webextendrecord> >(importObjectString);
            var importExtensions   = webextendrecords as Webextendrecord[] ?? webextendrecords.ToArray();

            foreach (var webextendrecord in importExtensions)
            {
                if (webextendrecord.cono != 0)
                {
                    webextendrecord.cono = this._tokenObject.Cono;
                }
            }
            return(importExtensions);
        }
示例#2
0
        public IEnumerable <Webmodrecord> ImportWebModificationsPartOne(byte[] zipFile)
        {
            var user         = this._pvUserRepository.Get(this._tokenObject.Cono, this._tokenObject.Oper.StripOffDomain(), 1, "webmodificationaccesslevel");
            var allowCompany = user.webmodificationaccesslevel.ToLower() == "c";
            var allowProfile = allowCompany || user.webmodificationaccesslevel.ToLower() == "p";
            var allowUser    = allowCompany || allowProfile || user.webmodificationaccesslevel.ToLower() == "u";

            if (!allowUser)
            {
                ErrorReportingHelper.ReportErrors("special.saapa.import.denied");
            }

            var importObjectString = ZipClass.Decompress(zipFile);
            var webmodRecords      = JsonConvert.DeserializeObject <IEnumerable <Webmodrecord> >(importObjectString);
            var importWebMods      = webmodRecords as Webmodrecord[] ?? webmodRecords.ToArray();

            foreach (var webmodrecord in importWebMods)
            {
                webmodrecord.cono = this._tokenObject.Cono;
                if (allowCompany && string.IsNullOrEmpty(webmodrecord.profile) &&
                    string.IsNullOrEmpty(webmodrecord.@operator))
                {
                    continue;
                }
                if (allowProfile)
                {
                    if (string.IsNullOrEmpty(webmodrecord.profile) && string.IsNullOrEmpty(webmodrecord.@operator))
                    {
                        webmodrecord.@operator    = this.CheckUser(webmodrecord.@operator);
                        webmodrecord.errorMessage = "special.saapa.import.defaultoperatorset";

                        continue;
                    }
                    if (!string.IsNullOrEmpty(webmodrecord.profile))
                    {
                        var profile = this.CheckProfle(webmodrecord.profile);
                        if (profile == Noprofile)
                        {
                            webmodrecord.errorMessage = "special.saapa.import.noprofile";
                            webmodrecord.profile      = string.Empty;
                            webmodrecord.profile      = this.CheckUser(webmodrecord.@operator);
                        }

                        if (profile != webmodrecord.profile)
                        {
                            webmodrecord.errorMessage = "special.saapa.import.profileset";
                        }

                        webmodrecord.profile = this.CheckProfle(webmodrecord.profile);
                        continue;
                    }
                    var oper = this.CheckUser(webmodrecord.@operator);
                    if (oper != webmodrecord.@operator)
                    {
                        webmodrecord.errorMessage = "special.saapa.import.defaultoperatorset";
                    }
                    webmodrecord.@operator = oper;
                    continue;
                }
                webmodrecord.profile = string.Empty;
                var operAlllowUser = this.CheckUser(webmodrecord.@operator);
                if (operAlllowUser != webmodrecord.@operator)
                {
                    webmodrecord.errorMessage = "special.saapa.import.defaultoperatorset";
                }
                webmodrecord.@operator = operAlllowUser;
            }

            foreach (var webmodrecord in importWebMods)

            {
                var criteria = new Webmodlistcriteria()
                {
                    screenname = webmodrecord.screenname, functionname = webmodrecord.functionname, recordcountlimit = 1
                };
                if (string.IsNullOrEmpty(webmodrecord.profile) && string.IsNullOrEmpty(webmodrecord.@operator))
                {
                    criteria.level = "c";
                }
                if (!string.IsNullOrEmpty(webmodrecord.profile))
                {
                    criteria.level   = "p";
                    criteria.profile = webmodrecord.profile;
                }
                if (!string.IsNullOrEmpty(webmodrecord.@operator))
                {
                    criteria.level     = "o";
                    criteria.@operator = webmodrecord.@operator;
                }

                webmodrecord.willOverwrite = this._assharedentryRepository.GetWebModificationList(criteria).webmodlistresults.Any();
            }
            return(importWebMods);
        }