Node acl check fix

This commit is contained in:
Peter Grlica
2020-12-13 18:53:19 +01:00
parent fa3c460ac9
commit 3fda882b75
+2 -2
View File
@@ -438,7 +438,7 @@ func (svc node) updater(ctx context.Context, nodeID uint64, action func(...*node
func (svc node) FindBySharedNodeID(ctx context.Context, sharedNodeID uint64) (*types.Node, error) {
n, err := svc.store.LookupFederationNodeBySharedNodeID(ctx, sharedNodeID)
if !svc.ac.CanManageNode(ctx, n) {
if n != nil && !svc.ac.CanManageNode(ctx, n) {
return nil, NodeErrNotAllowedToManage()
}
@@ -448,7 +448,7 @@ func (svc node) FindBySharedNodeID(ctx context.Context, sharedNodeID uint64) (*t
func (svc node) FindByID(ctx context.Context, nodeID uint64) (*types.Node, error) {
n, err := svc.store.LookupFederationNodeByID(ctx, nodeID)
if !svc.ac.CanManageNode(ctx, n) {
if n != nil && !svc.ac.CanManageNode(ctx, n) {
return nil, NodeErrNotAllowedToManage()
}