mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-17 03:24:40 -07:00
Merge pull request #727 from nats-io/fix_route_permissions
Fixed crash related to route permissions after allow/deny feature
This commit is contained in:
@@ -395,14 +395,8 @@ func parseCluster(cm map[string]interface{}, opts *Options) error {
|
||||
// The parsing sets Import into Publish and Export into Subscribe, convert
|
||||
// accordingly.
|
||||
opts.Cluster.Permissions = &RoutePermissions{
|
||||
Import: &SubjectPermission{
|
||||
Allow: auth.defaultPermissions.Publish.Allow,
|
||||
Deny: auth.defaultPermissions.Publish.Deny,
|
||||
},
|
||||
Export: &SubjectPermission{
|
||||
Allow: auth.defaultPermissions.Subscribe.Allow,
|
||||
Deny: auth.defaultPermissions.Subscribe.Deny,
|
||||
},
|
||||
Import: auth.defaultPermissions.Publish,
|
||||
Export: auth.defaultPermissions.Subscribe,
|
||||
}
|
||||
}
|
||||
case "routes":
|
||||
|
||||
@@ -498,14 +498,9 @@ func (c *client) setRoutePermissions(perms *RoutePermissions) {
|
||||
// The Import permission is mapped to Publish
|
||||
// and Export permission is mapped to Subscribe.
|
||||
// For meaning of Import/Export, see canImport and canExport.
|
||||
p := &Permissions{}
|
||||
p.Publish = &SubjectPermission{
|
||||
Allow: perms.Import.Allow,
|
||||
Deny: perms.Import.Deny,
|
||||
}
|
||||
p.Subscribe = &SubjectPermission{
|
||||
Allow: perms.Export.Allow,
|
||||
Deny: perms.Export.Deny,
|
||||
p := &Permissions{
|
||||
Publish: perms.Import,
|
||||
Subscribe: perms.Export,
|
||||
}
|
||||
c.setPermissions(p)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user