Page 1 of 1

An auth example use please

Posted: Wed Sep 07, 2016 9:22 pm
by Kill
Can You please show me how to use the auth example ?Thanks

Re: An auth example use please

Posted: Wed Sep 07, 2016 9:30 pm
by Ayuto
http://wiki.sourcepython.com/general/config-auth.html
http://wiki.sourcepython.com/developing ... /auth.html

The command API also utilizes the auth API.

Example:

Syntax: Select all

from commands.typed import TypedSayCommand

@TypedSayCommand('!add', 'math.add')
def on_add(command_info, x:float, y:float):
print('Result:', x + y)
So, you need the permission "math.add" to execute the command "!add".

Re: An auth example use please

Posted: Wed Sep 07, 2016 9:33 pm
by Kill
Ayuto wrote:http://wiki.sourcepython.com/general/config-auth.html
http://wiki.sourcepython.com/developing ... /auth.html

The command API also utilizes the auth API.

Example:

Syntax: Select all

from commands.typed import TypedSayCommand

@TypedSayCommand('!add', 'math.add')
def on_add(command_info, x:float, y:float):
print('Result:', x + y)
So, you need the permission "math.add" to execute the command "!add".


Having myself as an admin in the json file, how can I use it? I mean, with Python and auth

Re: An auth example use please

Posted: Wed Sep 07, 2016 9:40 pm
by Ayuto
Check the second link in my post. That describes how to check, grant and remove permissions.

You might also want to take a look at the auth module itself:
http://wiki.sourcepython.com/developing ... th.manager