[V3 Permissions] 3rd party checks required modifications. #1758

Closed
opened 2018-06-01 18:59:06 +02:00 by mikeshardmind · 2 comments
mikeshardmind commented 2018-06-01 18:59:06 +02:00 (Migrated from github.com)

With the current model for hooking third party checks into the permissions cog, we need permissions to be loaded first and not be reloaded. This was a design oversight on my part.

I'll be postponing my other WIP stuff to resolve this in a satisfactory manner prior to b16, but this will require changes to how other checks which want to integrate into the permissions cog rather than operate separately need to function.

For anyone currently designing a 3rd party cog which uses these hooks:
After the intended changes, any function which is an attribute of your cog should be possible to use as an integrated check. Each cog will get 1 before and 1 after check with expected names.

__red_permissions_before and __red_permissions_after
These can call your already existing functions if needed, and will receive the same arguments the current which current checks already do.

With the current model for hooking third party checks into the permissions cog, we need permissions to be loaded first and not be reloaded. This was a design oversight on my part. I'll be postponing my other WIP stuff to resolve this in a satisfactory manner prior to b16, but this will require changes to how other checks which want to integrate into the permissions cog rather than operate separately need to function. For anyone currently designing a 3rd party cog which uses these hooks: After the intended changes, any function which is an attribute of your cog should be possible to use as an integrated check. Each cog will get 1 before and 1 after check with expected names. `__red_permissions_before` and `__red_permissions_after` These can call your already existing functions if needed, and will receive the same arguments the current which current checks already do.
mikeshardmind commented 2018-06-02 02:10:33 +02:00 (Migrated from github.com)

After these changes, cogs can have the following methods (async optional)

async def __red_permissions_before(ctx: commands.Context, *, level: str)
async def __red_permissions_after(ctx: commands.Context, *, level: str)

These methods should return None if not interfering with the normal check operation, True if it should run, False if it should not.

More detailed documentation for this will be available at a later date, but the original API was also undocumented.

After these changes, cogs can have the following methods (async optional) ```py async def __red_permissions_before(ctx: commands.Context, *, level: str) ``` ```py async def __red_permissions_after(ctx: commands.Context, *, level: str) ``` These methods should return `None` if not interfering with the normal check operation, `True` if it should run, `False` if it should not. More detailed documentation for this will be available at a later date, but the original API was also undocumented.
tekulvw commented 2018-06-03 00:11:02 +02:00 (Migrated from github.com)

Implemented with #1760

Implemented with #1760
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#1758
No description provided.