Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit 0e81b8d7 authored by Rob Carleski's avatar Rob Carleski 🇮🇸
Browse files

Allow for case-sensitive aliases

- Add alias checking logic, even through the API will dedup for us.
- Add owner/member update logic
parent 0c977898
......@@ -240,6 +240,10 @@ https://documentation.its.umich.edu/node/339/
if _ext_addr not in self.mcomm_group.externalMembers:
_needs_update = True
self._aliases = list(map(str.casefold, self.mcomm_group.aliases))
if self.alias.casefold() not in self._aliases:
_needs_update = True
if _needs_update:
self.logger.info(
'Mcommunity group needs updating',
......@@ -271,7 +275,7 @@ https://documentation.its.umich.edu/node/339/
exit(2)
try:
if self.alias not in self.mcomm_group.aliases:
if self.alias.casefold() not in getattr(self, '_aliases', []):
self.logger.info(
'Adding Mcommunity group alias',
extra={'entity': self.account}
......@@ -282,12 +286,12 @@ https://documentation.its.umich.edu/node/339/
self.logger.warning(e, extra={'entity': self.account})
try:
self.logger.info(
'Updating Mcommunity group membership',
extra={'entity': self.account}
)
if self.service in ['google', 'both']:
if _ext_addr not in self.mcomm_group.externalMembers:
self.logger.info(
'Updating Mcommunity group membership',
extra={'entity': self.account}
)
self.mcomm_group.externalMembers.append(_ext_addr)
if self.control_group in self.mcomm_group.memberGroups:
self.mcomm_group.memberGroups.remove(self.control_group)
......@@ -297,11 +301,13 @@ https://documentation.its.umich.edu/node/339/
exit(2)
try:
self.logger.info(
'Updating Mcommunity group ownership',
extra={'entity': self.account}
)
self.mcomm_group.owners.extend(self.owners)
owner_diff = set(self.owners) - set(self.mcomm_group.owners)
if owner_diff:
self.logger.info(
'Updating Mcommunity group ownership',
extra={'entity': self.account}
)
self.mcomm_group.owners.extend(owner_diff)
self.mcomm_group.owners.remove(
self.control_group
)
......@@ -451,7 +457,7 @@ The password for your requested shared account is:
self.username = re.sub(r'[\_\s]', '.', self.account.strip()).lower()
self.groupname = re.sub(r'[\_\.]', ' ', self.account.strip()).lower()
self.alias = re.sub(r'[\_\.]', ' ', self.full_name).strip().lower()
self.alias = re.sub(r'[\_\.]', ' ', self.full_name).strip()
self.email = '{}@{}'.format(
self.username,
self.config['google']['domain']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment