Ejemplo n.º 1
0
 public EmailTraceListener(string environment, string portalVersion, IEmailSenderService emailSender, IPortalSettings settings)
 {
     _portalVersion = portalVersion;
     _emailSender   = emailSender;
     _settings      = settings;
     Environment    = environment;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the URL to the given page.
        /// </summary>
        /// <param name="tabID">The tab ID.</param>
        /// <param name="isSuperTab">if set to <c>true</c> the page is a "super-tab," i.e. a host-level page.</param>
        /// <returns>Formatted URL.</returns>
        public string NavigateURL(int tabID, bool isSuperTab)
        {
            IPortalSettings _portalSettings = this._portalController.GetCurrentSettings();
            string          cultureCode     = Globals.GetCultureCode(tabID, isSuperTab, _portalSettings);

            return(this.NavigateURL(tabID, isSuperTab, _portalSettings, Null.NullString, cultureCode));
        }
Ejemplo n.º 3
0
        private LoginResultData UpdateToken(string renewalToken, PersistedToken ptoken, UserInfo userInfo)
        {
            var expiry = DateTime.UtcNow.AddMinutes(SessionTokenTtl);

            if (expiry > ptoken.RenewalExpiry)
            {
                // don't extend beyond renewal expiry and make sure it is marked in UTC
                expiry = new DateTime(ptoken.RenewalExpiry.Ticks, DateTimeKind.Utc);
            }

            ptoken.TokenExpiry = expiry;

#pragma warning disable 618 // Obsolete
            var obsoletePortalSettings = PortalController.Instance.GetCurrentPortalSettings();
#pragma warning restore 618 // Obsolete
            IPortalSettings  portalSettings = obsoletePortalSettings;
            IPortalAliasInfo portalAlias    = obsoletePortalSettings.PortalAlias;
            var secret      = ObtainSecret(ptoken.TokenId, portalSettings.GUID, userInfo.Membership.LastPasswordChangeDate);
            var jwt         = CreateJwtToken(secret, portalAlias.HttpAlias, ptoken, userInfo.Roles);
            var accessToken = jwt.RawData;

            // save hash values in DB so no one with access can create JWT header from existing data
            ptoken.TokenHash = GetHashedStr(accessToken);
            this.DataProvider.UpdateToken(ptoken);

            return(new LoginResultData
            {
                UserId = userInfo.UserID,
                DisplayName = userInfo.DisplayName,
                AccessToken = accessToken,
                RenewalToken = renewalToken,
            });
        }
Ejemplo n.º 4
0
 public EmailTraceListener(string environment, string portalVersion, IEmailSenderService emailSender, IPortalSettings settings)
 {
     _portalVersion = portalVersion;
     _emailSender = emailSender;
     _settings = settings;
     Environment = environment;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Checks whether profile property is accessible.
        /// </summary>
        /// <param name="portalSettings">The portal settings.</param>
        /// <param name="property">The property.</param>
        /// <param name="accessingUser">The accessing user.</param>
        /// <param name="targetUser">The target user.</param>
        /// <returns><c>true</c> if property accessible, otherwise <c>false</c>.</returns>
        public static bool CheckAccessLevel(IPortalSettings portalSettings, ProfilePropertyDefinition property, UserInfo accessingUser, UserInfo targetUser)
        {
            var isAdminUser = IsAdminUser(portalSettings, accessingUser, targetUser);

            // Use properties visible property but admins and hosts can always see the property
            var isVisible = property.Visible || isAdminUser;

            if (isVisible && !isAdminUser)
            {
                switch (property.ProfileVisibility.VisibilityMode)
                {
                case UserVisibilityMode.FriendsAndGroups:
                    isVisible = IsUser(accessingUser, targetUser);
                    if (!isVisible)
                    {
                        // Relationships
                        foreach (Relationship relationship in property.ProfileVisibility.RelationshipVisibilities)
                        {
                            if (targetUser.Social.UserRelationships.Any(userRelationship =>
                                                                        (userRelationship.RelationshipId == relationship.RelationshipId &&
                                                                         userRelationship.Status == RelationshipStatus.Accepted &&
                                                                         ((userRelationship.RelatedUserId == accessingUser.UserID && userRelationship.UserId == targetUser.UserID) ||
                                                                          (userRelationship.RelatedUserId == targetUser.UserID && userRelationship.UserId == accessingUser.UserID)))))
                            {
                                isVisible = true;
                                break;
                            }
                        }

                        // Groups/Roles
                        if (property.ProfileVisibility.RoleVisibilities.Any(role => accessingUser.IsInRole(role.RoleName)))
                        {
                            isVisible = true;
                        }
                    }

                    break;

                case UserVisibilityMode.AllUsers:
                    // property is visible to everyone so do nothing
                    break;

                case UserVisibilityMode.MembersOnly:
                    // property visible if accessing user is a member
                    isVisible = IsMember(accessingUser);
                    break;

                case UserVisibilityMode.AdminOnly:
                    // accessing user not admin user so property is hidden (unless it is the user him/herself)
                    isVisible = IsUser(accessingUser, targetUser);
                    break;
                }
            }

            return(isVisible);
        }
Ejemplo n.º 6
0
 public virtual void Initialize(string[] args, IPortalSettings portalSettings, IUserInfo userInfo, int activeTabId)
 {
     Args              = args;
     PortalSettings    = portalSettings;
     User              = userInfo;
     PortalId          = portalSettings.PortalId;
     TabId             = activeTabId;
     ValidationMessage = "";
     ParseFlags();
 }
Ejemplo n.º 7
0
        public void AddLog(string propertyName, string propertyValue, IPortalSettings portalSettings, int userID, string logType)
        {
            var properties    = new LogProperties();
            var logDetailInfo = new LogDetailInfo {
                PropertyName = propertyName, PropertyValue = propertyValue
            };

            properties.Add(logDetailInfo);
            this.AddLog(properties, portalSettings, userID, logType, false);
        }
Ejemplo n.º 8
0
        /// <inheritdoc/>
        public override void Initialize(string[] args, IPortalSettings portalSettings, IUserInfo userInfo, int activeTabId)
        {
            base.Initialize(args, portalSettings, userInfo, activeTabId);
            if (!userInfo.IsSuperUser)
            {
                this.AddMessage(this.LocalizeString("Prompt_ListServices_Unauthorized"));
            }

            this.ParseParameters(this);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Gets the standard URL without any specific page names.
 /// </summary>
 /// <param name="activeTab">The active tab.</param>
 /// <param name="url">The URL.</param>
 /// <param name="boardNameOrPageName">Name of the board name original page.</param>
 /// <param name="portalSettings">The portal settings.</param>
 /// <returns>Returns the Normal URL</returns>
 private static string GetStandardUrl(
     [NotNull] TabInfo activeTab,
     string url,
     string boardNameOrPageName,
     IPortalSettings portalSettings)
 {
     return(FriendlyUrlProvider.Instance()
            .FriendlyUrl(
                activeTab,
                $"{Globals.ApplicationURL(activeTab.TabID)}&{url}",
                boardNameOrPageName,
                portalSettings));
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Converts a File Path to a Folder Info.
        /// </summary>
        /// <param name="folderPath">The folder path.</param>
        /// <param name="portalSettings">The portal settings.</param>
        /// <returns>
        /// Returns the Folder Info.
        /// </returns>
        public static IFolderInfo ConvertFilePathToFolderInfo(string folderPath, IPortalSettings portalSettings)
        {
            try
            {
                folderPath = folderPath.Substring(portalSettings.HomeDirectoryMapPath.Length).Replace("\\", "/");
            }
            catch (Exception)
            {
                folderPath = folderPath.Replace("\\", "/");
            }

            return(FolderManager.Instance.GetFolder(portalSettings.PortalId, folderPath));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Checks if user has write access to the folder.
        /// </summary>
        /// <param name="folderId">The folder id.</param>
        /// <param name="portalSettings">The portal settings.</param>
        /// <returns>
        /// Returns if the user has write access to the folder.
        /// </returns>
        public static bool CheckIfUserHasFolderWriteAccess(int folderId, IPortalSettings portalSettings)
        {
            try
            {
                var checkFolder = folderId.Equals(-1)
                                      ? ConvertFilePathToFolderInfo(portalSettings.HomeDirectoryMapPath, portalSettings)
                                      : FolderManager.Instance.GetFolder(folderId);

                return(FolderPermissionController.HasFolderPermission(checkFolder.FolderPermissions, "WRITE"));
            }
            catch (Exception)
            {
                return(false);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Determines whether user is in the specified role.
        /// </summary>
        /// <param name="roles">The roles.</param>
        /// <param name="settings">The settings.</param>
        /// <returns>
        ///   <c>true</c> if [is in roles] [the specified roles]; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsInRoles(string roles, IPortalSettings settings)
        {
            var objUserInfo = UserController.Instance.GetCurrentUserInfo();

            var isInRoles = objUserInfo.IsSuperUser;

            if (isInRoles)
            {
                // super user
                return(true);
            }

            var context = HttpContext.Current;

            foreach (var role in roles.Split(';').Where(role => !string.IsNullOrEmpty(role)))
            {
                if (role.StartsWith("!"))
                {
                    var denyRole = role.Replace("!", string.Empty);

                    if ((!context.Request.IsAuthenticated && denyRole.Equals(Globals.glbRoleUnauthUserName)) || denyRole.Equals(Globals.glbRoleAllUsersName) ||
                        objUserInfo.IsInRole(denyRole))
                    {
                        break;
                    }
                }
                else
                {
                    if (settings.PortalId == objUserInfo.PortalID &&
                        settings.AdministratorId == objUserInfo.UserID)
                    {
                        isInRoles = true;
                        break;
                    }

                    if ((context.Request.IsAuthenticated || !role.Equals(Globals.glbRoleUnauthUserName)) &&
                        !role.Equals(Globals.glbRoleAllUsersName) && !objUserInfo.IsInRole(role))
                    {
                        continue;
                    }

                    isInRoles = true;
                    break;
                }
            }

            return(isInRoles);
        }
Ejemplo n.º 13
0
        public void AddLog(LogProperties properties, IPortalSettings portalSettings, int userID, string logTypeKey, bool bypassBuffering)
        {
            // supports adding a custom string for LogType
            var log = new LogInfo
            {
                LogUserID       = userID,
                LogTypeKey      = logTypeKey,
                LogProperties   = properties,
                BypassBuffering = bypassBuffering,
            };

            if (portalSettings != null)
            {
                log.LogPortalID   = portalSettings.PortalId;
                log.LogPortalName = portalSettings.PortalName;
            }

            LogController.Instance.AddLog(log);
        }
Ejemplo n.º 14
0
        private static bool IsAdminUser(IPortalSettings portalSettings, UserInfo accessingUser, UserInfo targetUser)
        {
            bool isAdmin = false;

            if (accessingUser != null)
            {
                // Is Super User?
                isAdmin = accessingUser.IsSuperUser;

                if (!isAdmin && targetUser.PortalID != -1)
                {
                    // Is Administrator
                    var administratorRoleName = portalSettings != null
                        ? portalSettings.AdministratorRoleName
                        : PortalController.Instance.GetPortal(targetUser.PortalID).AdministratorRoleName;

                    isAdmin = accessingUser.IsInRole(administratorRoleName);
                }
            }

            return(isAdmin);
        }
 internal abstract string FriendlyUrl(TabInfo tab, string path, string pageName, IPortalSettings portalSettings);
 public abstract string FriendlyUrl(TabInfo tab, string path, string pageName, IPortalSettings settings);
 public override string FriendlyUrl(TabInfo tab, string path, string pageName, IPortalSettings settings)
 {
     return(_providerInstance.FriendlyUrl(tab, path, pageName, settings));
 }
Ejemplo n.º 18
0
        public EvrikaPrinterClient(IEvrikaPrinterClientSettings settings, IMasterPortalSettings masterPortalSettings, IPortalSettings portalSettings)
        {
            var provider   = new ApiKeyAuthenticationProvider(portalSettings.ApiKey);
            var authClient = new AuthClient(new ClientSettings(provider, new FakeLog(), TimeSpan.FromSeconds(15), false),
                                            new TopologyProvider(settings.TestAuthUrls.Length > 0 ? settings.TestAuthUrls : portalSettings.AuthUrls));

            var result = authClient.AuthByPassAsync2(new AuthByPassRequest(masterPortalSettings.MasterLogin, masterPortalSettings.MasterPassword)).Result;

            result.EnsureSuccess();
            var authSid = result.Response.Sid;

            Console.WriteLine($"AuthSid: {authSid}");

            clusterClient = new ClusterClient(null, config =>
            {
                var repeatReplicasCount = settings.RepeatReplicasCount;
                config.ClusterProvider  = new FixedClusterProvider(settings.Host);
                config.SetupKonturHttpTransport();
                config.RepeatReplicas(repeatReplicasCount);
                config.ReplicaOrdering        = new AsIsReplicaOrdering();
                config.DefaultRequestStrategy = new ForkingRequestStrategy(new EqualDelaysProvider(repeatReplicasCount), repeatReplicasCount);
                config.AddRequestTransform(new DefaultHeadersTransform(new[]
                {
                    new Header("Authorization", $"auth.sid {authSid}"),
                    new Header("X-Kontur-Apikey", $"{settings.PortalApiKey}"),
                    new Header(HeaderNames.Accept, "application/json"),
                }));
                config.DefaultTimeout = settings.Timeout;
            });
        }
Ejemplo n.º 19
0
        }                                         // title for the new module. defaults to friendly name

        public override void Initialize(string[] args, IPortalSettings portalSettings, IUserInfo userInfo, int activeTabId)
        {
            base.Initialize(args, portalSettings, userInfo, activeTabId);
            ParseParameters(this);
        }
Ejemplo n.º 20
0
 public void AddLog(object businessObject, IPortalSettings portalSettings, int userID, string userName, EventLogType logType)
 {
     this.AddLog(businessObject, portalSettings, userID, userName, logType.ToString());
 }
Ejemplo n.º 21
0
        /// <inheritdoc/>
        public LoginResultData LoginUser(HttpRequestMessage request, LoginData loginData)
        {
            if (!JwtAuthMessageHandler.IsEnabled)
            {
                Logger.Trace(this.SchemeType + " is not registered/enabled in web.config file");
                return(EmptyWithError("disabled"));
            }

#pragma warning disable 618 // Obsolete
            var obsoletePortalSettings = PortalController.Instance.GetCurrentPortalSettings();
#pragma warning restore 618 // Obsolete

            IPortalSettings portalSettings = obsoletePortalSettings;
            if (portalSettings == null)
            {
                Logger.Trace("portalSettings = null");
                return(EmptyWithError("no-portal"));
            }

            IPortalAliasInfo portalAlias = obsoletePortalSettings.PortalAlias;
            var status    = UserLoginStatus.LOGIN_FAILURE;
            var ipAddress = request.GetIPAddress() ?? string.Empty;
            var userInfo  = UserController.ValidateUser(
                portalSettings.PortalId,
                loginData.Username,
                loginData.Password,
                "DNN",
                string.Empty,
                AuthScheme,
                ipAddress,
                ref status);

            if (userInfo == null)
            {
                Logger.Trace("user = null");
                return(EmptyWithError("bad-credentials"));
            }

            var valid =
                status == UserLoginStatus.LOGIN_SUCCESS ||
                status == UserLoginStatus.LOGIN_SUPERUSER ||
#pragma warning disable 618 // Obsolete
                status == UserLoginStatus.LOGIN_INSECUREADMINPASSWORD ||
                status == UserLoginStatus.LOGIN_INSECUREHOSTPASSWORD;
#pragma warning restore 618 // Obsolete

            if (!valid)
            {
                Logger.Trace("login status = " + status);
                return(EmptyWithError("bad-credentials"));
            }

            // save hash values in DB so no one with access can create JWT header from existing data
            var sessionId    = NewSessionId;
            var now          = DateTime.UtcNow;
            var renewalToken = EncodeBase64(Hasher.ComputeHash(Guid.NewGuid().ToByteArray()));
            var ptoken       = new PersistedToken
            {
                TokenId       = sessionId,
                UserId        = userInfo.UserID,
                TokenExpiry   = now.AddMinutes(SessionTokenTtl),
                RenewalExpiry = now.AddDays(RenewalTokenTtl),
                RenewalHash   = GetHashedStr(renewalToken),
            };

            var secret = ObtainSecret(sessionId, portalSettings.GUID, userInfo.Membership.LastPasswordChangeDate);
            var jwt    = CreateJwtToken(
                secret,
                portalAlias.HttpAlias,
                ptoken,
                userInfo.Roles);
            var accessToken = jwt.RawData;

            ptoken.TokenHash = GetHashedStr(accessToken);
            this.DataProvider.AddToken(ptoken);

            return(new LoginResultData
            {
                UserId = userInfo.UserID,
                DisplayName = userInfo.DisplayName,
                AccessToken = accessToken,
                RenewalToken = renewalToken,
            });
        }
Ejemplo n.º 22
0
 public void AddLog(string propertyName, string propertyValue, IPortalSettings portalSettings, int userID, EventLogType logType)
 {
     this.AddLog(propertyName, propertyValue, portalSettings, userID, logType.ToString());
 }
Ejemplo n.º 23
0
 /// <inheritdoc />
 void IEventLogger.AddLog(string name, string value, IPortalSettings portalSettings, int userID, Abstractions.Logging.EventLogType logType)
 {
     this.EventLogger.AddLog(name, value, portalSettings, userID, logType.ToString());
 }
        private string FriendlyUrl(TabInfo tab, string path, string pageName, string portalAlias, IPortalSettings portalSettings)
        {
            string friendlyPath = path;
            bool   isPagePath   = (tab != null);

            if ((UrlFormat == UrlFormatType.HumanFriendly))
            {
                if ((tab != null))
                {
                    Dictionary <string, string> queryStringDic = GetQueryStringDictionary(path);
                    if ((queryStringDic.Count == 0 || (queryStringDic.Count == 1 && queryStringDic.ContainsKey("tabid"))))
                    {
                        friendlyPath = GetFriendlyAlias("~/" + tab.TabPath.Replace("//", "/").TrimStart('/') + ".aspx", portalAlias, true);
                    }
                    else if ((queryStringDic.Count == 2 && queryStringDic.ContainsKey("tabid") && queryStringDic.ContainsKey("language")))
                    {
                        if (!tab.IsNeutralCulture)
                        {
                            friendlyPath = GetFriendlyAlias("~/" + tab.CultureCode + "/" + tab.TabPath.Replace("//", "/").TrimStart('/') + ".aspx",
                                                            portalAlias,
                                                            true)
                                           .ToLowerInvariant();
                        }
                        else
                        {
                            friendlyPath = GetFriendlyAlias("~/" + queryStringDic["language"] + "/" + tab.TabPath.Replace("//", "/").TrimStart('/') + ".aspx",
                                                            portalAlias,
                                                            true)
                                           .ToLowerInvariant();
                        }
                    }
                    else
                    {
                        if (queryStringDic.ContainsKey("ctl") && !queryStringDic.ContainsKey("language"))
                        {
                            switch (queryStringDic["ctl"].ToLowerInvariant())
                            {
                            case "terms":
                                friendlyPath = GetFriendlyAlias("~/terms.aspx", portalAlias, true);
                                break;

                            case "privacy":
                                friendlyPath = GetFriendlyAlias("~/privacy.aspx", portalAlias, true);
                                break;

                            case "login":
                                friendlyPath = (queryStringDic.ContainsKey("returnurl"))
                                                    ? GetFriendlyAlias("~/login.aspx?ReturnUrl=" + queryStringDic["returnurl"], portalAlias, true)
                                                    : GetFriendlyAlias("~/login.aspx", portalAlias, true);
                                break;

                            case "register":
                                friendlyPath = (queryStringDic.ContainsKey("returnurl"))
                                                    ? GetFriendlyAlias("~/register.aspx?returnurl=" + queryStringDic["returnurl"], portalAlias, true)
                                                    : GetFriendlyAlias("~/register.aspx", portalAlias, true);
                                break;

                            default:
                                //Return Search engine friendly version
                                return(GetFriendlyQueryString(tab, GetFriendlyAlias(path, portalAlias, true), pageName));
                            }
                        }
                        else
                        {
                            //Return Search engine friendly version
                            return(GetFriendlyQueryString(tab, GetFriendlyAlias(path, portalAlias, true), pageName));
                        }
                    }
                }
            }
            else
            {
                //Return Search engine friendly version
                friendlyPath = GetFriendlyQueryString(tab, GetFriendlyAlias(path, portalAlias, isPagePath), pageName);
            }

            friendlyPath = CheckPathLength(Globals.ResolveUrl(friendlyPath), path);

            // Replace http:// by https:// if SSL is enabled and site is marked as secure
            // (i.e. requests to http://... will be redirected to https://...)
            portalSettings = portalSettings ?? PortalController.Instance.GetCurrentPortalSettings();
            if (tab != null && portalSettings != null && portalSettings.SSLEnabled && tab.IsSecure &&
                friendlyPath.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase))
            {
                friendlyPath = "https://" + friendlyPath.Substring("http://".Length);

                // If portal's "SSL URL" setting is defined: Use "SSL URL" instaed of current portal alias
                var sslUrl = portalSettings.SSLURL;
                if (!string.IsNullOrEmpty(sslUrl))
                {
                    friendlyPath = friendlyPath.Replace("https://" + portalAlias, "https://" + sslUrl);
                }
            }

            return(friendlyPath);
        }
Ejemplo n.º 25
0
 public void AddLog(IPortalSettings portalSettings, int userID, EventLogType logType)
 {
     this.AddLog(new LogProperties(), portalSettings, userID, logType.ToString(), false);
 }
Ejemplo n.º 26
0
 /// <inheritdoc />
 void IEventLogger.AddLog(IPortalSettings portalSettings, int userID, Abstractions.Logging.EventLogType logType)
 {
     this.EventLogger.AddLog(new LogProperties(), portalSettings, userID, logType.ToString(), false);
 }
Ejemplo n.º 27
0
        public void AddLog(object businessObject, IPortalSettings portalSettings, int userID, string userName, string logType)
        {
            var log = new LogInfo {
                LogUserID = userID, LogTypeKey = logType
            };

            if (portalSettings != null)
            {
                log.LogPortalID   = portalSettings.PortalId;
                log.LogPortalName = portalSettings.PortalName;
            }

            if (businessObject is PortalInfo)
            {
                var portal = (PortalInfo)businessObject;
                log.LogProperties.Add(new LogDetailInfo("PortalID", portal.PortalID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("PortalName", portal.PortalName));
                log.LogProperties.Add(new LogDetailInfo("Description", portal.Description));
                log.LogProperties.Add(new LogDetailInfo("KeyWords", portal.KeyWords));
                log.LogProperties.Add(new LogDetailInfo("LogoFile", portal.LogoFile));
            }
            else if (businessObject is TabInfo)
            {
                var tab = (TabInfo)businessObject;
                log.LogProperties.Add(new LogDetailInfo("TabID", tab.TabID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("PortalID", tab.PortalID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("TabName", tab.TabName));
                log.LogProperties.Add(new LogDetailInfo("Title", tab.Title));
                log.LogProperties.Add(new LogDetailInfo("Description", tab.Description));
                log.LogProperties.Add(new LogDetailInfo("KeyWords", tab.KeyWords));
                log.LogProperties.Add(new LogDetailInfo("Url", tab.Url));
                log.LogProperties.Add(new LogDetailInfo("ParentId", tab.ParentId.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("IconFile", tab.IconFile));
                log.LogProperties.Add(new LogDetailInfo("IsVisible", tab.IsVisible.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("SkinSrc", tab.SkinSrc));
                log.LogProperties.Add(new LogDetailInfo("ContainerSrc", tab.ContainerSrc));
            }
            else if (businessObject is ModuleInfo)
            {
                var module = (ModuleInfo)businessObject;
                log.LogProperties.Add(new LogDetailInfo("ModuleId", module.ModuleID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("ModuleTitle", module.ModuleTitle));
                log.LogProperties.Add(new LogDetailInfo("TabModuleID", module.TabModuleID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("TabID", module.TabID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("PortalID", module.PortalID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("ModuleDefId", module.ModuleDefID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("FriendlyName", module.DesktopModule.FriendlyName));
                log.LogProperties.Add(new LogDetailInfo("IconFile", module.IconFile));
                log.LogProperties.Add(new LogDetailInfo("Visibility", module.Visibility.ToString()));
                log.LogProperties.Add(new LogDetailInfo("ContainerSrc", module.ContainerSrc));
            }
            else if (businessObject is UserInfo)
            {
                var user = (UserInfo)businessObject;
                log.LogProperties.Add(new LogDetailInfo("UserID", user.UserID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("FirstName", user.Profile.FirstName));
                log.LogProperties.Add(new LogDetailInfo("LastName", user.Profile.LastName));
                log.LogProperties.Add(new LogDetailInfo("UserName", user.Username));
                log.LogProperties.Add(new LogDetailInfo("Email", user.Email));
            }
            else if (businessObject is RoleInfo)
            {
                var role = (RoleInfo)businessObject;
                log.LogProperties.Add(new LogDetailInfo("RoleID", role.RoleID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("RoleName", role.RoleName));
                log.LogProperties.Add(new LogDetailInfo("PortalID", role.PortalID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("Description", role.Description));
                log.LogProperties.Add(new LogDetailInfo("IsPublic", role.IsPublic.ToString(CultureInfo.InvariantCulture)));
            }
            else if (businessObject is DesktopModuleInfo)
            {
                var desktopModule = (DesktopModuleInfo)businessObject;
                log.LogProperties.Add(new LogDetailInfo("DesktopModuleID", desktopModule.DesktopModuleID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("ModuleName", desktopModule.ModuleName));
                log.LogProperties.Add(new LogDetailInfo("FriendlyName", desktopModule.FriendlyName));
                log.LogProperties.Add(new LogDetailInfo("FolderName", desktopModule.FolderName));
                log.LogProperties.Add(new LogDetailInfo("Description", desktopModule.Description));
            }
            else if (businessObject is FolderInfo)
            {
                var folderInfo = (FolderInfo)businessObject;
                log.LogProperties.Add(new LogDetailInfo("FolderID", folderInfo.FolderID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("PortalID", folderInfo.PortalID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("FolderName", folderInfo.FolderName));
                log.LogProperties.Add(new LogDetailInfo("FolderPath", folderInfo.FolderPath));
                log.LogProperties.Add(new LogDetailInfo("FolderMappingID", folderInfo.FolderMappingID.ToString(CultureInfo.InvariantCulture)));
            }
            else if (businessObject is FileInfo)
            {
                var fileInfo = (FileInfo)businessObject;
                log.LogProperties.Add(new LogDetailInfo("FileID", fileInfo.FileId.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("PortalID", fileInfo.PortalId.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("FolderID", fileInfo.FolderId.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("FolderMappingID", fileInfo.FolderMappingID.ToString(CultureInfo.InvariantCulture)));
                log.LogProperties.Add(new LogDetailInfo("ContentType", fileInfo.ContentType));
                log.LogProperties.Add(new LogDetailInfo("FileName", fileInfo.FileName));
                log.LogProperties.Add(new LogDetailInfo("FolderName", fileInfo.Folder));
                log.LogProperties.Add(new LogDetailInfo("PhysicalPath", fileInfo.PhysicalPath));
                log.LogProperties.Add(new LogDetailInfo("VersionGuid", fileInfo.VersionGuid.ToString()));
            }
            else
            {
                // Serialise using XmlSerializer
                log.LogProperties.Add(new LogDetailInfo("logdetail", XmlUtils.Serialize(businessObject)));
            }

            LogController.Instance.AddLog(log);
        }
Ejemplo n.º 28
0
 /// <inheritdoc />
 void IEventLogger.AddLog(object businessObject, IPortalSettings portalSettings, int userID, string userName, Abstractions.Logging.EventLogType logType)
 {
     this.AddLog(businessObject, portalSettings, userID, userName, logType.ToString());
 }
 internal override string FriendlyUrl(TabInfo tab, string path, string pageName, IPortalSettings settings)
 {
     return(FriendlyUrl(tab, path, pageName, ((PortalSettings)settings)?.PortalAlias.HTTPAlias, settings));
 }
Ejemplo n.º 30
0
        public override string FriendlyUrl(TabInfo tab, string path, string pageName, IPortalSettings settings)
        {
            if (settings == null)
            {
                return(FriendlyUrl(tab, path, pageName));
            }

            return(FriendlyUrl(tab, path, pageName, ((DotNetNuke.Entities.Portals.PortalSettings)settings).PortalAlias.HTTPAlias));
        }
Ejemplo n.º 31
0
 public TraceListenersInitializer(IPortalSettings portalSettings, IEmailSenderService emailService)
 {
     _portalSettings = portalSettings;
     _emailService = emailService;
 }
Ejemplo n.º 32
0
 public BlobCorsInitializer(IPortalSettings settings, CloudBlobClient blobClient)
 {
     _settings = settings;
     _blobClient = blobClient;
 }