示例#1
0
    return _change_password(req, 'zato.security.tech-account.change-password')
    
    
@method_allowed('GET')
def get_by_id(req, id_, cluster_id):
    try:
        response = req.zato.client.invoke('zato.security.tech-account.get-by-id', {'id':id_})
    except Exception, e:
        msg = 'Could not fetch the technical account, e:[{e}]'.format(e=format_exc(e))
        logger.error(msg)
        return HttpResponseServerError(msg)
    else:
        tech_account = TechnicalAccount()
        tech_account.id = response.data.id
        tech_account.name = response.data.name
        tech_account.is_active = response.data.is_active

        return HttpResponse(tech_account.to_json(), mimetype='application/javascript')
    
class Index(_Index):
    method_allowed = 'GET'
    url_name = 'security-tech-account'
    template = 'zato/security/tech-account.html'
    
    service_name = 'zato.security.tech-account.get-list'
    output_class = TechnicalAccount
    
    class SimpleIO(_Index.SimpleIO):
        input_required = ('cluster_id',)
        output_required = ('id', 'name', 'is_active')
        output_repeated = True
示例#2
0
@method_allowed('GET')
def get_by_id(req, id_, cluster_id):
    try:
        response = req.zato.client.invoke(
            'zato.security.tech-account.get-by-id', {'id': id_})
    except Exception, e:
        msg = 'Could not fetch the technical account, e:[{e}]'.format(
            e=format_exc(e))
        logger.error(msg)
        return HttpResponseServerError(msg)
    else:
        tech_account = TechnicalAccount()
        tech_account.id = response.data.id
        tech_account.name = response.data.name
        tech_account.is_active = response.data.is_active

        return HttpResponse(tech_account.to_json(),
                            mimetype='application/javascript')


class Index(_Index):
    method_allowed = 'GET'
    url_name = 'security-tech-account'
    template = 'zato/security/tech-account.html'

    service_name = 'zato.security.tech-account.get-list'
    output_class = TechnicalAccount

    class SimpleIO(_Index.SimpleIO):
        input_required = ('cluster_id', )
示例#3
0
def get_by_id(req, tech_account_id, cluster_id):
    try:
        zato_message, soap_response = invoke_admin_service(
            req.zato.cluster, "zato:security.tech-account.get-by-id", {"tech_account_id": tech_account_id}
        )
    except Exception, e:
        msg = "Could not fetch the technical account, e:[{e}]".format(e=format_exc(e))
        logger.error(msg)
        return HttpResponseServerError(msg)
    else:
        tech_account = TechnicalAccount()
        tech_account_elem = zato_message.response.item

        tech_account.id = tech_account_elem.id.text
        tech_account.name = tech_account_elem.name.text
        tech_account.is_active = is_boolean(tech_account_elem.is_active.text)

        return HttpResponse(tech_account.to_json(), mimetype="application/javascript")


class Index(_Index):
    meth_allowed = "GET"
    url_name = "security-tech-account"
    template = "zato/security/tech-account.html"

    soap_action = "zato:security.tech-account.get-list"
    output_class = TechnicalAccount

    class SimpleIO(_Index.SimpleIO):
        input_required = ("cluster_id",)
        output_required = ("id", "name", "is_active")