Przeglądaj źródła

获取用户信息工具类

rengb 4 lat temu
rodzic
commit
d2facf6ddf

+ 66 - 0
common/src/main/java/com/lantone/common/util/SysUserUtils.java

@@ -0,0 +1,66 @@
+package com.lantone.common.util;
+
+/**
+ * @Description:
+ * @author:
+ * @time:
+ */
+public class SysUserUtils {
+
+    private static final String AUTHORIZATION = "authorization";
+
+    /**
+     * 获取当前请求的token
+     *
+     * @return
+     */
+    public static String getCurrentToken() {
+        return null;
+    }
+
+    /**
+     * 获取当前请求的用户名称
+     *
+     * @return
+     */
+    public static String getCurrentPrinciple() {
+        return "0000";
+    }
+
+    /**
+     * 获取当前请求的用户ID
+     *
+     * @return
+     */
+    public static String getCurrentPrincipleID() {
+        return "0000";
+    }
+
+    /**
+     * 获取当前请求用户的医院ID
+     *
+     * @return
+     */
+    public static String getCurrentHospitalID() {
+        return "0000";
+    }
+
+    /**
+     * 判读当前token用户是否为接口所需的参数username
+     *
+     * @param username
+     * @return
+     */
+    public static boolean isMyself(String username) {
+        return username.equals(getCurrentPrinciple());
+    }
+
+    /**
+     * @param role
+     * @return
+     */
+    public static boolean hasRole(String role) {
+        return false;
+    }
+
+}