Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5da08fd

Browse filesBrowse files
committed
use GetRequiredUserId() in WithAudit
1 parent 22d3d7a commit 5da08fd
Copy full SHA for 5da08fd

2 files changed

+8-5Lines changed: 8 additions & 5 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎ServiceStack/src/ServiceStack/AutoQueryDataFeature.cs‎

Copy file name to clipboardExpand all lines: ServiceStack/src/ServiceStack/AutoQueryDataFeature.cs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,9 +1580,9 @@ public static void Or<T>(this IDataQuery q, Expression<Func<T, object>> fieldExp
15801580
var pi = fieldExpr.ToPropertyInfo();
15811581
q.AddCondition(QueryTerm.Or, pi, condition, value);
15821582
}
1583-
1583+
15841584
public static T WithAudit<T>(this T row, IRequest req, DateTime? date = null) where T : AuditBase =>
1585-
row.WithAudit(req.GetSession().UserAuthId, date);
1585+
row.WithAudit(req.GetRequiredUserId(), date);
15861586

15871587
public static T WithAudit<T>(this T row, string by, DateTime? date = null) where T : AuditBase
15881588
{
Collapse file

‎ServiceStack/src/ServiceStack/ServerClaimUtils.cs‎

Copy file name to clipboardExpand all lines: ServiceStack/src/ServiceStack/ServerClaimUtils.cs
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ public static class ServerClaimUtils
1414
if (apiKeyUserId != null)
1515
return apiKeyUserId;
1616
var user = req.GetClaimsPrincipal();
17-
return user.IsAuthenticated()
18-
? user.GetUserId()
19-
: null;
17+
if (user.IsAuthenticated())
18+
return user.GetUserId();
19+
var session = req.GetSession();
20+
if (session?.IsAuthenticated == true)
21+
return session.UserAuthId;
22+
return null;
2023
}
2124

2225
/// <summary>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.