-
Notifications
You must be signed in to change notification settings - Fork 9
Moderation logs #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Moderation logs #326
Conversation
|
Тести не пройшли через не до кінця видалену роль ROLE_RESTRICTED |
Можна знов залити зміни з |
|
@kuyugama Тепер немає конфліктів, буду вдячний якщо зробиш code review |
| "bad-backup-token": ["Bad backup token", 401], | ||
| }, | ||
| "moderation-log": { | ||
| "no-access": ["You do not have permission to access", 400], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are permission check in auth_requied dependency with its permission error, why creating new?
| async def validate_moderation_role( | ||
| author: User = Depends(auth_required(optional=False)), | ||
| ): | ||
| if author.role not in ["admin", "moderator"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of checking roles, you should add permission and check by it using auth_required. If you need custom error, you can add parameter for it into auth_required
| async def get_edit(session, content_id): | ||
| return await session.scalar(select(Edit).filter(Edit.id == content_id)) | ||
|
|
||
|
|
||
| async def get_comment(session, content_id): | ||
| return await session.scalar( | ||
| select(Comment).filter(Comment.id == content_id) | ||
| ) | ||
|
|
||
|
|
||
| async def get_collection(session, content_id): | ||
| return await session.scalar( | ||
| select(Collection).filter(Collection.id == content_id) | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to load author fields using options method on select query object
Генерує логи модерації
Tasklist