Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bwallet
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Go
bwallet
Commits
5e88c69b
Commit
5e88c69b
authored
Apr 21, 2021
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/rbac' into 'master'
rbac See merge request
!42
parents
30a013a7
3f48bbf1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
14 deletions
+7
-14
auth.go
middleware/auth/auth.go
+1
-8
router.go
routers/router.go
+6
-6
No files found.
middleware/auth/auth.go
View file @
5e88c69b
...
...
@@ -13,13 +13,6 @@ func AUTH(handlerTableName map[string]string) gin.HandlerFunc {
token
:=
ctx
.
Request
.
Header
.
Get
(
"Token"
)
user
,
_
:=
util
.
ParseToken
(
token
)
if
81
==
user
.
UserInfo
.
Uid
{
handler
.
SendResponse
(
ctx
,
errno
.
PermissionDenied
,
nil
)
ctx
.
Abort
()
return
}
if
81
!=
user
.
UserInfo
.
Uid
{
ctx
.
Next
()
}
...
...
@@ -29,7 +22,7 @@ func AUTH(handlerTableName map[string]string) gin.HandlerFunc {
ctx
.
Next
()
}
handleAlowed
:=
[]
string
{
"Get
Wallets"
,
"GetWalletCoinRelationCoinRelations"
,
"GetCo
ins"
}
handleAlowed
:=
[]
string
{
"Get
CoinChains"
,
"GetUserCha
ins"
}
_
,
handle
:=
util
.
Contains
(
handleAlowed
,
handlerName
)
if
!
handle
{
...
...
routers/router.go
View file @
5e88c69b
package
routers
import
(
"bwallet/middleware/auth"
"bwallet/middleware/jwt"
"bwallet/middleware/log"
"bwallet/pkg/e"
...
...
@@ -44,16 +45,15 @@ func InitRouter() *gin.Engine {
client
.
GET
(
"/live-charge"
,
app
.
GetLiveCharge
)
client
.
GET
(
"/live/status"
,
app
.
LiveStatus
)
client
.
POST
(
"/live/notifyUrl"
,
app
.
NotifyUrl
)
client
.
POST
(
"/live/verify"
,
app
.
VerifyStatus
)
client
.
GET
(
"/live-banners"
,
app
.
GetLiveBanners
)
client
.
POST
(
"/live/verify"
,
app
.
VerifyStatus
)
client
.
GET
(
"/live-banners"
,
app
.
GetLiveBanners
)
client
.
GET
(
"/fees/recommended"
,
app
.
GetTransactionGas
)
client
.
GET
(
"/tokenview/explore"
,
app
.
Explore
)
client
.
GET
(
"/fees/recommended"
,
app
.
GetTransactionGas
)
client
.
GET
(
"/tokenview/explore"
,
app
.
Explore
)
api
:=
r
.
Group
(
"/api"
)
api
.
Use
(
jwt
.
JWT
())
//api.Use(auth.AUTH(e.HandleTableName))
api
.
Use
(
jwt
.
JWT
())
.
Use
(
auth
.
AUTH
(
e
.
HandleTableName
))
api
.
POST
(
"/log"
,
backend
.
AddOperationLog
)
api
.
GET
(
"/logs"
,
backend
.
GetOperationLogs
)
api
.
Use
(
log
.
LogMiddleware
(
e
.
HandleTableName
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment