Exemple #1
0
 /// <summary>
 /// Loads the user and his rights and audits to the session object.
 /// </summary>
 /// <param name="session">The session the method works on</param>
 /// <param name="user">The user to be added to the session.</param>
 public static async Task LoadUserSessionDataAsync(this ISession session, UserEntity user)
 {
     session.AddUserObject(user);
     session.AddSystemActionRights(await SecurityGuiHelper.GetSystemActionRightsForUserAsync(user.UserID));
     session.AddAuditActions(await SecurityGuiHelper.GetAuditActionsForUserAsync(user.UserID));
     session.AddForumsActionRights(await SecurityGuiHelper.GetForumsActionRightsForUserAsync(user.UserID));
     if ((user.UserID > 0) && (user.LastVisitedDate.HasValue))
     {
         session.AddLastVisitDate(user.LastVisitedDate.Value);
     }
     else
     {
         session.AddLastVisitDate(DateTime.Now);
     }
 }
Exemple #2
0
 /// <summary>
 /// Loads the anonymous user session data.
 /// </summary>
 /// <param name="session">The session the method works on</param>
 public static async Task LoadAnonymousSessionDataAsync(this ISession session)
 {
     session.AddForumsActionRights(await SecurityGuiHelper.GetForumsActionRightsForUserAsync(0));
 }