PR#4423: docs: remove repetition in "Writing Koji plugins"
Merges #4423 https://pagure.io/koji/pull-request/4423 Fixes: #4424 https://pagure.io/koji/issue/4424 docs: remove repetition in "Writing Koji plugins
This commit is contained in:
commit
f2b13a9ae2
1 changed files with 0 additions and 21 deletions
|
|
@ -114,27 +114,6 @@ You can try calling the new XMLRPC API with the Python client library:
|
|||
>>> session = koji.ClientSession("http://koji/example.org/kojihub")
|
||||
>>> session.mymethod(arg1, arg2, kwarg1='some value')
|
||||
|
||||
Ensuring the user has the required permissions
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you want your new XMLRPC API to require specific permissions from the
|
||||
user, all you need to do is add the following to your method:
|
||||
|
||||
::
|
||||
|
||||
from koji.context import context
|
||||
|
||||
def mymethod(arg1, arg2, kwarg1=None):
|
||||
context.session.assertPerm("admin")
|
||||
|
||||
# Here is where you actually do something
|
||||
|
||||
mymethod.exported = True
|
||||
|
||||
In the example above, Koji will ensure that the user is an
|
||||
administrator. You could of course create your own permission, and check
|
||||
for that.
|
||||
|
||||
Running code automatically triggered on events
|
||||
----------------------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue