mirror of
https://github.com/gravitl/netmaker.git
synced 2026-04-23 00:17:10 +08:00
NM-288: move the platform user check in the middleware
This commit is contained in:
@@ -59,7 +59,7 @@ func NetworkPermissionsCheck(username string, r *http.Request) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if userRole.ID == schema.Auditor || userRole.ID == schema.PlatformUser {
|
||||
if userRole.ID == schema.Auditor {
|
||||
if r.Method == http.MethodGet {
|
||||
return nil
|
||||
} else {
|
||||
@@ -80,6 +80,9 @@ func NetworkPermissionsCheck(username string, r *http.Request) error {
|
||||
if netID == "" {
|
||||
return errors.New("network id is missing")
|
||||
}
|
||||
if userRole.ID == schema.PlatformUser && r.Method == http.MethodGet {
|
||||
return nil
|
||||
}
|
||||
if r.Method == "" {
|
||||
r.Method = http.MethodGet
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user