def post(self, request, *args, **kwargs): self.users = AuthServiceApi.get_users() hub_id = kwargs.get('hub') device_id = kwargs.get('device') permission_id = kwargs.get('pk') self.object = AuthServiceApi.get_device_user_permission( hub_id, device_id, permission_id) return super(UpdateDeviceUserPermissionView, self).post(request, *args, **kwargs)
def get(self, request, *args, **kwargs): token = self.request.COOKIES.get('user_token') hub = AuthServiceApi.get_hub(kwargs['hub']) device = InternalApi.get_device(token, hub, kwargs['pk']) self.device = device self.users = AuthServiceApi.get_users() self.groups = AuthServiceApi.get_groups() self.user_permissions = AuthServiceApi.get_device_user_permissions( hub['pk'], device['pk']) self.group_permissions = AuthServiceApi.get_device_group_permissions( hub['pk'], device['pk']) return super(DevicePermissionsView, self).get(request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.users = AuthServiceApi.get_users() return super(AddDeviceUserPermissionView, self).post(request, *args, **kwargs)