feat: get user api return roles and permissions (#929)

This commit is contained in:
Resulte Lee
2022-07-30 17:31:56 +08:00
committed by GitHub
parent 1c72f5300c
commit 155660b0d7
9 changed files with 62 additions and 0 deletions

View File

@ -229,3 +229,13 @@ func removePolicies(permission *Permission) {
panic(err)
}
}
func GetPermissionsByUser(userId string) []*Permission {
permissions := []*Permission{}
err := adapter.Engine.Where("users like ?", "%"+userId+"%").Find(&permissions)
if err != nil {
panic(err)
}
return permissions
}