Skip to content

Conversation

@ardelato
Copy link
Collaborator

@ardelato ardelato commented Jul 3, 2025

Description

This adds two new feature flags to auto-approve groups and events. We already had an auto-approve flag for events, but it was tied to the Networks table. Instead of adding a new column to the Networks table for groups, we will extract both as env variables.

CR Notes

I added some additional security around the auto-approval features by tying it with the user roles. Only Host roles and above will be auto-approved for group and event creation.

I should note that new users start of with the RESTARTER role then are elevated to the HOST role once they create a group. However, there is already checks in place to prevent these users from creating events for other groups. Therefore, this will not cause issues with current perm functionality.

qa_req 0

ardelato added 2 commits July 3, 2025 09:29
This adds two new feature flags to auto-approve groups and events. We
already had an auto-approve flag for events, but it was tied to the
Networks table. Instead of adding a new column to the Networks table for
groups, we will extracct both as env variables.
… events

This adds some security to the auto-approve feature. Only Restarter users
and higher will be auto-approved for creating groups. I should note
a Restarter user will automatically be elevated to a Host user once they
create a group; however, their Host role is only tied to the group they
created. Therefore, they will still not be able to create or auto-approve
events for other groups.
Copy link
Member

@mlahargou mlahargou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR 📱


return $autoapprove;
// Events are auto-approved based on environment configuration
return env('FEATURE__AUTO_APPROVE_EVENTS', false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If FEATURE__AUTO_APPROVE_EVENTS is false, do we want to keep the previous behavior?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole network feature is similar to multiple instances of Restarters.

We don't really use the Network feature so having to check the group on all networks would not apply for us.

if ($autoapprove) {
Log::info("Auto-approve event $idParty");
// Only auto-approve if the feature is enabled AND the user has privileged role (Root, Admin, Host)
if ($autoapprove && $user->role <= ROLE::HOST) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably right, but funky lol. I would have assumed ROOT was a higher level than HOST. But I'm assuming they are just numbers starting with 1 for highest permission.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I'm assuming they are just numbers starting with 1 for highest permission.

Correct

const ROOT = 1;
const ADMINISTRATOR = 2;
const HOST = 3;
const RESTARTER = 4;
const GUSET = 5;
const NETWORK_COORDINATOR = 6;

@ardelato ardelato merged commit afdda02 into hermes Jul 14, 2025
@ardelato ardelato deleted the feat--add-auto-approve-env-vars branch July 14, 2025 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants