Skip to content
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

Creating an organization while not having a global authorization #730

Open
marien-probesys opened this issue Sep 9, 2024 · 0 comments
Open
Labels
ready ✅ You can work on this! type: improvements Things could be nicer
Milestone

Comments

@marien-probesys
Copy link
Member

marien-probesys commented Sep 9, 2024

Problem

When an admin creates an organization, but they don't have a global authorization, the admin cannot access the new organization. This is very disturbing.

Solution

If the admin who created the organization is unable to access it, redirect to the list of organizations and display a notification explaining that they are missing an authorization.

A better solution might be to give an authorization to a team or an agent in the same time as the organization is created. This solution may be explored in the future, but is out of the scope of this issue.

Specification

In src/Controller/OrganizationsController.php, before redirecting to the list of organizations, check if the current user has access to the organization:

// with $authorizer being a \App\Security\Authorizer
if ($authorizer->isGranted(`orga:see`, $organization)) {
    // ...
}

If the condition is true, set a "success" notification:

// Translation: "The organization has been created."
$this->addFlash('success', $translator->trans('organizations.new.created'));

If the condition is false, set a "success" notification:

// Translation: "The organization has been created but you’re not authorized to access it."
$this->addFlash('success', $translator->trans('organizations.new.created_no_access'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ✅ You can work on this! type: improvements Things could be nicer
Projects
None yet
Development

No branches or pull requests

1 participant