-
Notifications
You must be signed in to change notification settings - Fork 55
Add multi default orgs #34
base: master
Are you sure you want to change the base?
Conversation
any news ? |
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'],
} |
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.
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) |
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.
Shouldn't this be
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): |
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.
nit.. rename organizations
to org
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, |
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.
organization=organizations, | |
organization=org, |
@sergeohl any chance to see improvements on this PR soon? |
With this PR I add a way to subscribe in several organizations by default.
Like that: