Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@rpc(String, Integer, String, Boolean)
@authenticated_uid
@soap_faults
# pylint: disable=too-many-arguments
def finish_pdebuild(self, uid, builddir, cpuset, profile, cross):
self.app.pm.open_project(uid, builddir)
self.app.pm.build_current_pdebuild(uid, cpuset, profile, cross)
@rpc(String)
@authenticated_uid
@soap_faults
def reset_project(self, uid, builddir):
self.app.pm.open_project(uid, builddir)
self.app.pm.db.reset_project(builddir, True)
@rpc(_returns=Iterable(User))
def get_all_user(ctx):
return ctx.udc.session.query(User)
@rpc(String)
@authenticated_uid
@soap_faults
def del_project(self, uid, builddir):
self.app.pm.del_project(uid, builddir)
@rpc(
models.Inform,
_returns=models.InformResponse,
_body_style="bare",
_operation_name="Inform",
_out_message_name="InformResponse",
)
def inform(ctx, request):
""" Inform response generated locally """
fill_response_header(ctx)
resp = AutoConfigServer._handle_tr069_message(ctx, request)
resp.MaxEnvelopes = AutoConfigServer._max_envelopes
return resp
@rpc(Mandatory.Unicode, _returns=ByteArray(encoding='hex'))
def get(ctx, file_name):
path = os.path.join(os.path.abspath('./files'), file_name)
if not path.startswith(os.path.abspath('./files')):
raise ValidationError(file_name)
try:
f = open(path, 'r')
except IOError:
raise ResourceNotFoundError(file_name)
ctx.transport.resp_headers['Content-Disposition'] = (
'attachment; filename=%s;' % file_name)
data = f.read(BLOCK_SIZE)
while len(data) > 0:
yield data
@rpc(Mandatory.String, _throws=PublicKeyError, _returns=Preferences)
def get_preferences(ctx, user_name):
if user_name == 'smith':
raise AuthorizationError()
retval = preferences_db[user_name]
return retval
@rpc(String)
@authenticated_uid
@soap_faults
def build_sysroot(self, uid, builddir):
self.app.pm.open_project(uid, builddir)
self.app.pm.build_sysroot(uid)
@rpc(Mandatory.UnsignedInteger32, _returns=User)
def get_user(ctx, user_id):
return ctx.udc.session.query(User).filter_by(id=user_id).one()
@rpc(String, String)
@authenticated_uid
@soap_faults
def include_package(self, uid, builddir, filename):
self.app.pm.open_project(uid, builddir)
self.app.pm.add_deb_package(uid, filename)