25개 이상의 토픽을 선택하실 수 없습니다.
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
-
- //
-
-
-
-
-
-
-
-
- namespace SafeCampus.System;
-
- /// <summary>
- /// 当前登录用户信息
- /// </summary>
- public class UserManager
- {
- /// <summary>
- /// 当前用户Id
- /// </summary>
- public static long UserId
- {
- get
- {
- return (App.User?.FindFirst(ClaimConst.USER_ID)?.Value).ToLong();
- }
- }
-
- /// <summary>
- /// 当前用户账号
- /// </summary>
- public static string UserAccount
- {
- get
- {
- return App.User?.FindFirst(ClaimConst.ACCOUNT)?.Value;
- }
- }
-
- /// <summary>
- /// 当前用户昵称
- /// </summary>
- public static string Name
- {
- get
- {
- return App.User?.FindFirst(ClaimConst.NAME)?.Value;
- }
- }
-
- /// <summary>
- /// 是否超级管理员
- /// </summary>
- public static bool SuperAdmin
- {
- get
- {
- return (App.User?.FindFirst(ClaimConst.IS_SUPER_ADMIN)?.Value).ToBoolean();
- }
- }
-
- /// <summary>
- /// 机构ID
- /// </summary>
- public static long OrgId
- {
- get
- {
- return (App.User?.FindFirst(ClaimConst.ORG_ID)?.Value).ToLong();
- }
- }
-
- public static long? TenantId
- {
- get
- {
- //如果有租户ID则返回租户ID,否则返回null
- return (App.User?.FindFirst(ClaimConst.TENANT_ID)?.Value).ToLong();
- }
- }
- }
|