yepcord / server

Unofficial discord backend implementation in python.
GNU Affero General Public License v3.0
2 stars 1 forks source link

check permissions #43

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

https://github.com/yepcord/server/blob/5299d15ee1c021fd39746a6c58767cf1ee5f20f8/server/http_api/main.py#L1158


    return "", 204

@app.route("/api/v9/guilds/<int:guild>/channels", methods=["PATCH"])
@multipleDecorators(usingDB, getUser, getGuildWoM)
async def api_guilds_guild_channels_patch(user, guild):
    if guild.owner_id != user.id: # TODO: check permissions
        raise InvalidDataErr(403, mkError(50013))
    if not (data := await request.get_json()):
        return "", 204
    for change in data:
        if not (channel := await core.getChannel(int(change["id"]))):
            continue
        del change["id"]
        if "type" in change: del change["type"]
        if "guild_id" in change: del change["guild_id"]
        if "parent_id" in change and change["parent_id"] is not None: change["parent_id"] = int(change["parent_id"])
        nChannel = Channel(channel.id, channel.type, channel.guild_id, **change)
        await core.updateChannelDiff(channel, nChannel)
        channel.set(**change)
        await core.sendChannelUpdateEvent(channel)
    return "", 204

# Stickers & gifs
github-actions[bot] commented 1 year ago

Closed in fa58ee4961e68a84866da45444cfcee905dd6fe9

github-actions[bot] commented 1 year ago

Closed in fa58ee4961e68a84866da45444cfcee905dd6fe9

github-actions[bot] commented 1 year ago

Closed in fa58ee4961e68a84866da45444cfcee905dd6fe9

github-actions[bot] commented 1 year ago

Closed in fa58ee4961e68a84866da45444cfcee905dd6fe9

github-actions[bot] commented 1 year ago

Closed in fa58ee4961e68a84866da45444cfcee905dd6fe9

github-actions[bot] commented 1 year ago

Closed in fa58ee4961e68a84866da45444cfcee905dd6fe9

github-actions[bot] commented 1 year ago

Closed in fa58ee4961e68a84866da45444cfcee905dd6fe9