[V3 Admin] Fix permission problems #1774

Closed
laggron42 wants to merge 3 commits from patch-16 into V3/develop
laggron42 commented 2018-06-02 09:54:33 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Any owner could interact with an other guild without permissions using [p]announce ignore. Now it checks if the member has permissions on the selected guild.

This is not tested but should work.

### Type - [x] Bugfix - [ ] Enhancement - [ ] New feature ### Description of the changes Any owner could interact with an other guild without permissions using [p]announce ignore. Now it checks if the member has permissions on the selected guild. This is not tested but should work.
tekulvw (Migrated from github.com) reviewed 2018-06-02 09:54:33 +02:00
mikeshardmind commented 2018-06-02 11:38:52 +02:00 (Migrated from github.com)

There's no permission issue here. Something that should be changed is removing the guild argument though. There's no guild converter, so this will never resolve to a guild not the current one.

There's no permission issue here. Something that should be changed is removing the guild argument though. There's no guild converter, so this will never resolve to a guild not the current one.
laggron42 commented 2018-06-02 12:10:37 +02:00 (Migrated from github.com)

The discord.Guild argument is used. Currently, you just have to create a new server, invite the bot (so you're considered as a guild owner) and use the command while specifying a different guild (with name or ID; what the converter supports)

The `discord.Guild` argument is used. Currently, you just have to create a new server, invite the bot (so you're considered as a guild owner) and use the command while specifying a different guild (with name or ID; what the converter supports)
mikeshardmind commented 2018-06-02 12:20:01 +02:00 (Migrated from github.com)

Just because an argument is type-hinted, doesn't mean there's a supported converter. At the entry to the command callback, guild will always be None currently

You can test this behavior with the below snippet if you'd like:

[p]eval
```py
from redbot.core import checks
class NoGuildConverter:
    
    @checks.is_owner()
    @commands.command()
    async def guildid(self, ctx, *, g: discord.Guild = None):
        if not g:
            return await ctx.send("No Guild")
        await ctx.send(f"{g.id}: {g.name}")

bot.add_cog(NoGuildConverter())
```

then use [p]guildid [ID, name, whatever you wanna try here], or you can just look and see that there isn't a converter for guilds.

Just because an argument is type-hinted, doesn't mean there's a supported converter. At the entry to the command callback, guild will **always** be `None` currently You can test this behavior with the below snippet if you'd like: ````` [p]eval ```py from redbot.core import checks class NoGuildConverter: @checks.is_owner() @commands.command() async def guildid(self, ctx, *, g: discord.Guild = None): if not g: return await ctx.send("No Guild") await ctx.send(f"{g.id}: {g.name}") bot.add_cog(NoGuildConverter()) ``` ````` then use `[p]guildid [ID, name, whatever you wanna try here]`, or you can just look and see that there isn't a converter for guilds.
laggron42 commented 2018-06-02 12:35:07 +02:00 (Migrated from github.com)

Even if that's not supported atm, what says that discord.py won't bring an update for that? It's just dangerous to keep that in the code. Always None for now? Anyway there's never enough security check.

Even if that's not supported atm, what says that discord.py won't bring an update for that? It's just dangerous to keep that in the code. Always `None` for now? Anyway there's never enough security check.
Twentysix26 commented 2018-06-02 12:50:24 +02:00 (Migrated from github.com)

"Administrator" is misspelled in the code

"Administrator" is misspelled in the code
tekulvw commented 2018-06-03 00:16:14 +02:00 (Migrated from github.com)

Closing in favor of #1781

Closing in favor of #1781

Pull request closed

Sign in to join this conversation.
No reviewers
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!1774
No description provided.