/usr/share/doc/tryton-server-doc/html/topics/user_application.html is in tryton-server-doc 4.6.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>User Application — trytond 4.6 documentation</title>
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '4.6',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Modules" href="modules/index.html" />
<link rel="prev" title="Remote Procedure Call" href="rpc.html" />
</head>
<body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="modules/index.html" title="Modules"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="rpc.html" title="Remote Procedure Call"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">trytond 4.6 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Using trytond</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="user-application">
<span id="topics-user-application"></span><h1>User Application<a class="headerlink" href="#user-application" title="Permalink to this headline">¶</a></h1>
<p>Tryton provides a way to connect URL rules to an callable endpoint using the
decorator method <cite>route</cite> of the <cite>trytond.application.app</cite> instance. This allows
to define a custom API based on HTTP that can be used to create a specific user
application.</p>
<p>The decorator takes as first parameter a string which follow the <a class="reference external" href="http://werkzeug.pocoo.org/docs/latest/routing/#rule-format">Rule
Format</a> of Werkzeug and as second parameter sequence of HTTP methods.</p>
<p>Example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">trytond.application</span> <span class="k">import</span> <span class="n">app</span>
<span class="nd">@app</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s1">'/hello'</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s1">'GET'</span><span class="p">])</span>
<span class="k">def</span> <span class="nf">hello</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
<span class="k">return</span> <span class="s1">'Hello world'</span>
</pre></div>
</div>
<p>Tryton also provides some wrappers in <cite>trytond.protocols.wrappers</cite> to ease the
creation of such route.</p>
<blockquote>
<div><ul class="simple">
<li><cite>set_max_request_size(size)</cite>: change the default limit of the request to
the size in bytes.</li>
<li><cite>with_pool</cite>: which takes the first parameter as database name and
replace it by the corresponding instance of the <a class="reference internal" href="../ref/pool.html#ref-pool"><span class="std std-ref">Pool</span></a>.</li>
<li><cite>with_transaction([readonly])</cite>: which starts a <code class="xref py py-class docutils literal"><span class="pre">Transaction</span></code> using
the <a class="reference internal" href="../ref/pool.html#ref-pool"><span class="std std-ref">Pool</span></a> from <cite>with_pool</cite>. If <cite>readonly</cite> is not set,
the transaction will not be readonly for <cite>POST</cite>, <cite>PUT</cite>, <cite>DELETE</cite> and
<cite>PATCH</cite> methods and readonly for all others.</li>
<li><cite>user_application(name[, json])</cite>: which set the <code class="xref py py-attr docutils literal"><span class="pre">Transaction.user</span></code>
from the <cite>Authorization</cite> header using the type <cite>bearer</cite> and a valid key
for the named user application.</li>
</ul>
</div></blockquote>
<div class="section" id="user-application-key">
<h2>User Application Key<a class="headerlink" href="#user-application-key" title="Permalink to this headline">¶</a></h2>
<p>Tryton also provides a easy way to manage access to user application using
keys per named application.
A key is created with a <cite>POST</cite> request on the <cite>URL</cite>
<cite>/<database_name>/user/application/</cite> which returns the key. The request must
contain as data a json object with the keys:</p>
<blockquote>
<div><ul class="simple">
<li><cite>user</cite>: the user login</li>
<li><cite>application</cite>: the name of the application</li>
</ul>
</div></blockquote>
<p>After the creation, the key must be validated by the user from the preferences
of a Tryton client.</p>
<p>A key can be deleted with a <cite>DELETE</cite> request on the same <cite>URL</cite>. The request
must contain as data a json object with the keys:</p>
<blockquote>
<div><ul class="simple">
<li><cite>user</cite>: the user login</li>
<li><cite>key</cite>: the key to delete</li>
<li><cite>application</cite>: the name of the application of the key</li>
</ul>
</div></blockquote>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">User Application</a><ul>
<li><a class="reference internal" href="#user-application-key">User Application Key</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="rpc.html"
title="previous chapter">Remote Procedure Call</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="modules/index.html"
title="next chapter">Modules</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/topics/user_application.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="modules/index.html" title="Modules"
>next</a> |</li>
<li class="right" >
<a href="rpc.html" title="Remote Procedure Call"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">trytond 4.6 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="index.html" >Using trytond</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2008-2018, Bertrand Chenal, Cédric Krier, Ian Wilson, Udo Spallek.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.7.
</div>
</body>
</html>
|