奇淼(piexlmax
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 222 additions and 243 deletions
-
15server/api/v1/system/sys_user.go
-
2server/config.yaml
-
1server/config/jwt.go
-
3server/go.mod
-
10server/go.sum
-
1server/main.go
-
5server/middleware/casbin_rbac.go
-
8server/middleware/email.go
-
8server/middleware/operation.go
-
8server/model/system/request/jwt.go
-
52server/plugin/ws/utils/utils.go
-
39server/utils/clamis.go
-
14server/utils/jwt.go
-
181web/package-lock.json
-
96web/package.json
-
1web/src/style/basics.scss
-
14web/src/style/main.scss
-
4web/src/view/superAdmin/operation/sysOperationRecord.vue
-
3web/src/view/systemTools/system/system.vue
@ -1,52 +0,0 @@ |
|||
package utils |
|||
|
|||
import ( |
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request" |
|||
"github.com/gin-gonic/gin" |
|||
uuid "github.com/satori/go.uuid" |
|||
) |
|||
|
|||
// 从Gin的Context中获取从jwt解析出来的用户ID
|
|||
func GetUserID(c *gin.Context) uint { |
|||
if claims, exists := c.Get("claims"); !exists { |
|||
global.GVA_LOG.Error("从Gin的Context中获取从jwt解析出来的用户ID失败, 请检查路由是否使用jwt中间件!") |
|||
return 0 |
|||
} else { |
|||
waitUse := claims.(*systemReq.CustomClaims) |
|||
return waitUse.ID |
|||
} |
|||
} |
|||
|
|||
// 从Gin的Context中获取从jwt解析出来的用户UUID
|
|||
func GetUserUuid(c *gin.Context) uuid.UUID { |
|||
if claims, exists := c.Get("claims"); !exists { |
|||
global.GVA_LOG.Error("从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件!") |
|||
return uuid.UUID{} |
|||
} else { |
|||
waitUse := claims.(*systemReq.CustomClaims) |
|||
return waitUse.UUID |
|||
} |
|||
} |
|||
|
|||
// 从Gin的Context中获取从jwt解析出来的用户角色id
|
|||
func GetUserAuthorityId(c *gin.Context) string { |
|||
if claims, exists := c.Get("claims"); !exists { |
|||
global.GVA_LOG.Error("从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件!") |
|||
return "" |
|||
} else { |
|||
waitUse := claims.(*systemReq.CustomClaims) |
|||
return waitUse.AuthorityId |
|||
} |
|||
} |
|||
|
|||
// 从Gin的Context中获取从jwt解析出来的用户角色id
|
|||
func GetUserInfo(c *gin.Context) *systemReq.CustomClaims { |
|||
if claims, exists := c.Get("claims"); !exists { |
|||
global.GVA_LOG.Error("从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件!") |
|||
return nil |
|||
} else { |
|||
waitUse := claims.(*systemReq.CustomClaims) |
|||
return waitUse |
|||
} |
|||
} |
@ -1,50 +1,50 @@ |
|||
{ |
|||
"name": "gin-vue-admin", |
|||
"version": "2.3.5", |
|||
"private": true, |
|||
"scripts": { |
|||
"serve": "node openDocument.js && vite --host --mode development", |
|||
"build": "vite build --mode production", |
|||
"preview": "vite preview" |
|||
}, |
|||
"dependencies": { |
|||
"@element-plus/icons": "0.0.11", |
|||
"axios": "^0.19.2", |
|||
"core-js": "^3.6.5", |
|||
"echarts": "4.9.0", |
|||
"element-plus": "^1.1.0-beta.20", |
|||
"highlight.js": "^10.6.0", |
|||
"marked": "^2.0.0", |
|||
"mitt": "^3.0.0", |
|||
"path": "^0.12.7", |
|||
"qs": "^6.8.0", |
|||
"quill": "^1.3.7", |
|||
"screenfull": "^5.0.2", |
|||
"script-ext-html-webpack-plugin": "^2.1.4", |
|||
"spark-md5": "^3.0.1", |
|||
"vue": "^3.2.0", |
|||
"vue-particle-line": "^0.1.4", |
|||
"vue-router": "^4.0.0-0", |
|||
"vuex": "^4.0.0-0", |
|||
"vuex-persist": "^2.1.0" |
|||
}, |
|||
"devDependencies": { |
|||
"@vitejs/plugin-legacy": "^1.4.4", |
|||
"@vitejs/plugin-vue": "latest", |
|||
"@vue/cli-plugin-babel": "~4.5.0", |
|||
"@vue/cli-plugin-eslint": "~4.5.0", |
|||
"@vue/cli-plugin-router": "~4.5.0", |
|||
"@vue/cli-plugin-vuex": "~4.5.0", |
|||
"@vue/cli-service": "~4.5.0", |
|||
"@vue/compiler-sfc": "^3.1.5", |
|||
"babel-eslint": "^10.1.0", |
|||
"babel-plugin-import": "^1.13.3", |
|||
"dotenv": "^10.0.0", |
|||
"eslint": "^6.7.2", |
|||
"eslint-plugin-vue": "^7.0.0", |
|||
"sass": "^1.26.5", |
|||
"sass-loader": "^8.0.2", |
|||
"vite": "2", |
|||
"vite-plugin-importer": "^0.2.5" |
|||
} |
|||
"name": "gin-vue-admin", |
|||
"version": "2.3.5", |
|||
"private": true, |
|||
"scripts": { |
|||
"serve": "node openDocument.js && vite --host --mode development", |
|||
"build": "vite build --mode production", |
|||
"preview": "vite preview" |
|||
}, |
|||
"dependencies": { |
|||
"@element-plus/icons": "0.0.11", |
|||
"axios": "^0.19.2", |
|||
"core-js": "^3.6.5", |
|||
"echarts": "4.9.0", |
|||
"element-plus": "^1.1.0-beta.24", |
|||
"highlight.js": "^10.6.0", |
|||
"marked": "^2.0.0", |
|||
"mitt": "^3.0.0", |
|||
"path": "^0.12.7", |
|||
"qs": "^6.8.0", |
|||
"quill": "^1.3.7", |
|||
"screenfull": "^5.0.2", |
|||
"script-ext-html-webpack-plugin": "^2.1.4", |
|||
"spark-md5": "^3.0.1", |
|||
"vue": "^3.2.0", |
|||
"vue-particle-line": "^0.1.4", |
|||
"vue-router": "^4.0.0-0", |
|||
"vuex": "^4.0.0-0", |
|||
"vuex-persist": "^2.1.0" |
|||
}, |
|||
"devDependencies": { |
|||
"@vitejs/plugin-legacy": "^1.4.4", |
|||
"@vitejs/plugin-vue": "latest", |
|||
"@vue/cli-plugin-babel": "~4.5.0", |
|||
"@vue/cli-plugin-eslint": "~4.5.0", |
|||
"@vue/cli-plugin-router": "~4.5.0", |
|||
"@vue/cli-plugin-vuex": "~4.5.0", |
|||
"@vue/cli-service": "~4.5.0", |
|||
"@vue/compiler-sfc": "^3.1.5", |
|||
"babel-eslint": "^10.1.0", |
|||
"babel-plugin-import": "^1.13.3", |
|||
"dotenv": "^10.0.0", |
|||
"eslint": "^6.7.2", |
|||
"eslint-plugin-vue": "^7.0.0", |
|||
"sass": "^1.26.5", |
|||
"sass-loader": "^8.0.2", |
|||
"vite": "2", |
|||
"vite-plugin-importer": "^0.2.5" |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue