Skip to content
This repository has been archived by the owner on Sep 24, 2023. It is now read-only.

Add multi default orgs #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sergeohl
Copy link

With this PR I add a way to subscribe in several organizations by default.

Like that:

AUTH_LDAP_DEFAULT_SENTRY_ORGANIZATION = u'My Organization Name,Sentry'

@sergeohl
Copy link
Author

any news ?

@barronhagerman barronhagerman self-assigned this Sep 5, 2019
@Bessonov
Copy link

I'm not sure, that it's sofisticated. From my point of view the mapping should happens on LDAP group level, like:

AUTH_LDAP_DEFAULT_SENTRY_ORGANIZATION = {
  ldap_group_x: [u'Sentry organization x'],
}

Copy link
Contributor

@barronhagerman barronhagerman left a comment

Choose a reason for hiding this comment

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

Sorry, this fell waayyy off my radar.

organizations = Organization.objects.filter(name=org)
if not organizations or len(organizations) < 1:
continue
self._add_user_in_organization(organizations[0], user, member_role, has_global_access)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be

Suggested change
self._add_user_in_organization(organizations[0], user, member_role, has_global_access)
self._add_user_in_organization(org, user, member_role, has_global_access)

@@ -82,3 +74,13 @@ def get_or_create_user(self, username, ldap_user):
)

return model

def _add_user_in_organization(self, organizations, user, member_role, has_global_access):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit.. rename organizations to org

Suggested change
def _add_user_in_organization(self, organizations, user, member_role, has_global_access):
def _add_user_in_organization(self, org, user, member_role, has_global_access):

def _add_user_in_organization(self, organizations, user, member_role, has_global_access):
# Add the user to the organization with global access
OrganizationMember.objects.create(
organization=organizations,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
organization=organizations,
organization=org,

@azmeuk
Copy link

azmeuk commented Dec 2, 2020

@sergeohl any chance to see improvements on this PR soon?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants