-
Notifications
You must be signed in to change notification settings - Fork 23
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
Setup attendee role and Configure video settings for talks #285
base: development
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThe PR implements attendee role functionality by modifying the world creation/update logic to include trait grants, which define role-based permissions. The implementation adds a new attendee role with configurable trait grants alongside existing admin and scheduleuser roles. Sequence diagram for world creation/update with attendee rolesequenceDiagram
participant User
participant API as API Endpoint
participant World
User->>API: POST request with world data
API->>World: Check if world exists
alt World exists
World->>World: Update domain, locale, timezone, trait_grants
else World does not exist
World->>World: Create new world with domain, locale, timezone, config, trait_grants
end
World-->>API: Response with world details
API-->>User: Return response
Class diagram for World model with trait grantsclassDiagram
class World {
String domain
String locale
String timezone
String config
Map trait_grants
}
note for World "The trait_grants attribute is added to manage role-based permissions."
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @odkhang - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider extracting the trait_grants dictionary into a separate function or constant to avoid duplication between the update and create paths
- Add validation for attendee_trait_grants input to ensure security of permission assignments
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟡 Security: 1 issue found
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Hey @odkhang - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider extracting the trait_grants initialization to avoid duplication in both the update and create paths
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
1aa1179
to
4278dee
Compare
server/venueless/api/task.py
Outdated
world.config["pretalx"] = { | ||
"event": event_slug, | ||
"domain": "{}".format(settings.EVENTYAY_TALK_BASE_PATH), | ||
"pushed": datetime.datetime.now().isoformat(), |
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.
Please always use timezone-aware datetime. Calling now
without tz
will create naive datetime.
server/venueless/api/task.py
Outdated
} | ||
world.save() | ||
except requests.exceptions.ConnectionError as e: | ||
logger.error("Connection error: %s", str(e)) |
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 don't need to wrap e
with str
. When the log message is to be built, the %
formatter will tell logging
to "stringify" the passed arguments.
Wrapping str
here is even undesired, it makes "stringify" operation run before we need to build the log message.
server/venueless/api/task.py
Outdated
logger.error("Connection error: %s", str(e)) | ||
self.retry(exc=e) | ||
except requests.exceptions.HTTPError as e: | ||
if e.response.status_code in (401, 403, 404): |
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.
Use enum from http
module, don't use hardcode 401, etc...
This pull request resolves fossasia/eventyay-tickets#465.