blob: 54b9c7c90084fe9fed82726151ed177f6fc400f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
using System;
using Microsoft.AspNetCore.Mvc;
using Timeline.Auth;
using Timeline.Services.User;
namespace Timeline.Controllers.V2
{
public class V2ControllerBase : ControllerBase
{
#region auth
protected bool UserHasPermission(UserPermission permission)
{
return User.HasPermission(permission);
}
protected long? GetOptionalAuthUserId()
{
return User.GetOptionalUserId();
}
protected long GetAuthUserId()
{
return GetOptionalAuthUserId() ?? throw new InvalidOperationException(Resource.ExceptionNoUserId);
}
#endregion
}
}
|