api/admin: rename mgmt-permission:* event to admin-permission:*

Be more consistent with Admin API name and method names.
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-17 02:41:42 +02:00
parent 3c99aab75a
commit cbc7241a93
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
4 changed files with 10 additions and 10 deletions

View File

@ -91,7 +91,7 @@ def method(name, *, no_payload=False, endpoints=None, **classifiers):
def apply_filters(iterable, filters):
'''Apply filters returned by mgmt-permission:... event'''
'''Apply filters returned by admin-permission:... event'''
for selector in filters:
iterable = filter(selector, iterable)
return iterable
@ -188,7 +188,7 @@ class AbstractQubesAPI(object):
def fire_event_for_permission(self, **kwargs):
'''Fire an event on the source qube to check for permission'''
return self.src.fire_event('mgmt-permission:' + self.method,
return self.src.fire_event('admin-permission:' + self.method,
pre_event=True, dest=self.dest, arg=self.arg, **kwargs)
def fire_event_for_filter(self, iterable, **kwargs):

View File

@ -43,7 +43,7 @@ class QubesMgmtEventsDispatcher(object):
self.send_event = send_event
def vm_handler(self, subject, event, **kwargs):
if event.startswith('mgmt-permission:'):
if event.startswith('admin-permission:'):
return
if not list(qubes.api.apply_filters([(subject, event, kwargs)],
self.filters)):

View File

@ -23,8 +23,8 @@ import qubes.ext
class AdminExtension(qubes.ext.Extension):
# pylint: disable=too-few-public-methods
@qubes.ext.handler(
'mgmt-permission:admin.vm.tag.Set',
'mgmt-permission:admin.vm.tag.Remove')
'admin-permission:admin.vm.tag.Set',
'admin-permission:admin.vm.tag.Remove')
def on_tag_set_or_remove(self, vm, event, arg, **kwargs):
'''Forbid changing specific tags'''
# pylint: disable=no-self-use,unused-argument

View File

@ -91,7 +91,7 @@ class AdminAPITestCase(qubes.tests.QubesTestCase):
response = loop.run_until_complete(
mgmt_obj.execute(untrusted_payload=payload))
self.assertEventFired(self.emitter,
'mgmt-permission:' + method.decode('ascii'))
'admin-permission:' + method.decode('ascii'))
return response
@ -110,7 +110,7 @@ class TC_00_VMs(AdminAPITestCase):
def test_010_vm_property_list(self):
# this test is kind of stupid, but at least check if appropriate
# mgmt-permission event is fired
# admin-permission event is fired
value = self.call_mgmt_func(b'admin.vm.property.List', b'test-vm1')
properties = self.app.domains['test-vm1'].property_list()
self.assertEqual(value,
@ -902,7 +902,7 @@ class TC_00_VMs(AdminAPITestCase):
loop.run_until_complete(execute_task)
self.assertIsNone(execute_task.result())
self.assertEventFired(self.emitter,
'mgmt-permission:' + 'admin.Events')
'admin-permission:' + 'admin.Events')
self.assertEqual(send_event.mock_calls,
[
unittest.mock.call(self.app, 'connection-established'),
@ -932,7 +932,7 @@ class TC_00_VMs(AdminAPITestCase):
vm2 = event_task.result()
self.assertIsNone(execute_task.result())
self.assertEventFired(self.emitter,
'mgmt-permission:' + 'admin.Events')
'admin-permission:' + 'admin.Events')
self.assertEqual(send_event.mock_calls,
[
unittest.mock.call(self.app, 'connection-established'),
@ -1242,7 +1242,7 @@ class TC_00_VMs(AdminAPITestCase):
def test_400_property_list(self):
# actual function tested for admin.vm.property.* already
# this test is kind of stupid, but at least check if appropriate
# mgmt-permission event is fired
# admin-permission event is fired
value = self.call_mgmt_func(b'admin.property.List', b'dom0')
properties = self.app.property_list()
self.assertEqual(value,