An auth example use please

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

An auth example use please

Postby Kill » Wed Sep 07, 2016 9:22 pm

Can You please show me how to use the auth example ?Thanks
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: An auth example use please

Postby Ayuto » Wed Sep 07, 2016 9:30 pm

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".
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

Re: An auth example use please

Postby Kill » Wed Sep 07, 2016 9:33 pm

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
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: An auth example use please

Postby Ayuto » Wed Sep 07, 2016 9:40 pm

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

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 29 guests