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:
Ivan Kozlovic
2018-08-27 19:16:35 -06:00
committed by GitHub
3 changed files with 132 additions and 16 deletions

View File

@@ -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":

View File

@@ -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)
}