Exemple #1
0
        /// <summary>
        /// Loads the user and his rights and audits to the session object.
        /// </summary>
        /// <param name="user">The user to be added to the session.</param>
        public static void LoadUserSessionData(UserEntity user)
        {
            // Adds the user object to session
            AddUserObject(user);

            ActionRightCollection systemActionRights = SecurityGuiHelper.GetSystemActionRightsForUser(user.UserID);

            // add user system rights to the session object
            AddSystemActionRights(systemActionRights);

            AuditActionCollection auditActions = SecurityGuiHelper.GetAuditActionsForUser(user.UserID);

            // add user audit actions to the session object
            AddAuditActions(auditActions);

            ForumRoleForumActionRightCollection forumActionRights = SecurityGuiHelper.GetForumsActionRightsForUser(user.UserID);

            // add user forums rights to the session object
            AddForumsActionRights(forumActionRights);

            // set the last visit date.
            if ((user.UserID > 0) && (user.LastVisitedDate.HasValue))
            {
                SessionAdapter.AddLastVisitDate(user.LastVisitedDate.Value, true);
            }
            else
            {
                SessionAdapter.AddLastVisitDate(DateTime.Now, true);
            }
        }