allow can_add to be called for permission info

* can_add() is called through our generic permission/access framework
for api creation (POST). However, can_add() may also be called for
purposes of determining if a user has perms to do something. Thus, the
data field may not contain 'name' in this case. Allow for that.
This commit is contained in:
Chris Meyers
2017-01-26 15:19:27 -05:00
parent fbebc58267
commit 6aaf6a3150

View File

@@ -614,7 +614,7 @@ class HostAccess(BaseAccess):
return False
# Check to see if we have enough licenses
self.check_license(add_host_name=data['name'])
self.check_license(add_host_name=data.get('name', None))
return True
def can_change(self, obj, data):