[V3 permissions] more docs + minor addition. (#1737)

* more info

* docstring
This commit is contained in:
Michael H 2018-05-28 16:02:42 -04:00 committed by palmtree5
parent de96f8b9f9
commit 9eb6bb7738
2 changed files with 33 additions and 3 deletions

View File

@ -37,6 +37,7 @@ For each of those, settings have varying priorities (listed below, highest to lo
7. Role settings (see below) 7. Role settings (see below)
8. Server whitelist 8. Server whitelist
9. Server blacklist 9. Server blacklist
10. Default settings
For the role whitelist and blacklist settings, For the role whitelist and blacklist settings,
roles will be checked individually in order from highest to lowest role the user has roles will be checked individually in order from highest to lowest role the user has
@ -73,3 +74,32 @@ An example of the expected format is shown below.
- 96733288462286848 - 96733288462286848
default: allow default: allow
----------------------
Example configurations
----------------------
Locking Audio cog to approved server(s) as a bot owner
.. code-block:: none
[p]permissions setglobaldefault Audio deny
[p]permissions addglobalrule allow Audio [server ID or name]
Locking Audio to specific voice channel(s) as a serverowner or admin:
.. code-block:: none
[p]permissions setguilddefault Audio deny
[p]permissions addguildrule allow Audio [voice channel ID or name]
Allowing extra roles to use cleanup
.. code-block:: none
[p]permissions addguildrule allow Cleanup [role ID]
Preventing cleanup from being used in channels where message history is important:
.. code-block:: none
[p]permissions addguildrule deny Cleanup [channel ID or mention]

View File

@ -12,7 +12,7 @@ from .resolvers import val_if_check_is_valid, resolve_models
from .yaml_handler import yamlset_acl, yamlget_acl from .yaml_handler import yamlset_acl, yamlget_acl
from .converters import CogOrCommand, RuleType from .converters import CogOrCommand, RuleType
_models = ["owner", "guildowner", "admin", "mod"] _models = ["owner", "guildowner", "admin", "mod", "all"]
_ = Translator("Permissions", __file__) _ = Translator("Permissions", __file__)
@ -94,7 +94,7 @@ class Permissions:
defering to check logic defering to check logic
This works since all checks must be True to run This works since all checks must be True to run
""" """
v = await self.check_overrides(ctx, "mod") v = await self.check_overrides(ctx, "all")
if v is False: if v is False:
return False return False
@ -109,7 +109,7 @@ class Permissions:
ctx: `redbot.core.context.commands.Context` ctx: `redbot.core.context.commands.Context`
The context of the command The context of the command
level: `str` level: `str`
One of 'owner', 'guildowner', 'admin', 'mod' One of 'owner', 'guildowner', 'admin', 'mod', 'all'
Returns Returns
------- -------