Make collaborative consistent (#753)

* Make collaborative consistent

* Update documentation

* Allow collaborative abbreviations for all ACL values

* Update documentation

* Update choices per Jay

* Update documentation
This commit is contained in:
Ross Scroggs
2018-07-05 12:39:27 -07:00
committed by Jay Lee
parent d536b6e43a
commit 47bc500f40
3 changed files with 33 additions and 21 deletions

View File

@@ -66,6 +66,8 @@ If an item contains spaces, it should be surrounded by ".
Google-Vault|
101031
<SKUID> ::=
cloudidentity|identity|1010010001|
cloudidentitypremium|identitypremium|1010050001|
free|standard|Google-Apps|
gafb|gafw|basic|gsuitebasic|Google-Apps-For-Business|
gafg|gsuitegovernment|gsuitegov|Google-Apps-For-Government|
@@ -629,7 +631,7 @@ Specify a collection of Users by directly specifying them or by specifiying item
(allowgooglecommunication <Boolean>)|
(allowwebposting <Boolean>)|
(archiveonly <Boolean>)|
(collaborative ALL_MEMBERS|OWNERS_AND_MANAGERS|MANAGERS_ONLY|OWNERS_ONLY|NONE)|
(collaborative (members|all_members)|(managers|owners_and_managers)|(managers_only)|(owners|owners_only)|none)|
(customfootertext <String>)|
(customreplyto <EmailAddress>)|
(defaultmessagedenynotificationtext <String>)|
@@ -649,22 +651,22 @@ Specify a collection of Users by directly specifying them or by specifiying item
(showingroupdirectory <Boolean>)|
(spammoderationlevel ALLOW|MODERATE|SILENTLY_MODERATE|REJECT)|
(whocanadd ALL_MEMBERS_CAN_ADD|ALL_MANAGERS_CAN_ADD|NONE_CAN_ADD)|
(whocanaddreferences ALL_MEMBERS|OWNERS_AND_MANAGERS|MANAGERS_ONLY|OWNERS_ONLY|NONE)|
(whocanassigntopics ALL_MEMBERS|OWNERS_AND_MANAGERS|MANAGERS_ONLY|OWNERS_ONLY|NONE)|
(whocanaddreferences (members|all_members)|(managers|owners_and_managers)|(managers_only)|(owners|owners_only)|none)|
(whocanassigntopics (members|all_members)|(managers|owners_and_managers)|(managers_only)|(owners|owners_only)|none)|
(whocancontactowner ANYONE_CAN_CONTACT|ALL_IN_DOMAIN_CAN_CONTACT|ALL_MEMBERS_CAN_CONTACT|ALL_MANAGERS_CAN_CONTACT)|
(whocanenterfreeformtags ALL_MEMBERS|OWNERS_AND_MANAGERS|MANAGERS_ONLY|OWNERS_ONLY|NONE)|
(whocanenterfreeformtags (members|all_members)|(managers|owners_and_managers)|(managers_only)|(owners|owners_only)|none)|
(whocaninvite ALL_MEMBERS_CAN_INVITE|ALL_MANAGERS_CAN_INVITE|NONE_CAN_INVITE)|
(whocanjoin ANYONE_CAN_JOIN|ALL_IN_DOMAIN_CAN_JOIN|INVITED_CAN_JOIN|CAN_REQUEST_TO_JOIN)|
(whocanleavegroup ALL_MANAGERS_CAN_LEAVE|ALL_MEMBERS_CAN_LEAVE|NONE_CAN_LEAVE)|
(whocanmarkduplicate ALL_MEMBERS|OWNERS_AND_MANAGERS|MANAGERS_ONLY|OWNERS_ONLY|NONE)|
(whocanmarkfavoritereplyonanytopic ALL_MEMBERS|OWNERS_AND_MANAGERS|MANAGERS_ONLY|OWNERS_ONLY|NONE)|
(whocanmarkfavoritereplyonowntopic ALL_MEMBERS|OWNERS_AND_MANAGERS|MANAGERS_ONLY|OWNERS_ONLY|NONE)|
(whocanmarknoresponseneeded ALL_MEMBERS|OWNERS_AND_MANAGERS|MANAGERS_ONLY|OWNERS_ONLY|NONE)|
(whocanmodifytagsandcategories ALL_MEMBERS|OWNERS_AND_MANAGERS|MANAGERS_ONLY|OWNERS_ONLY|NONE)|
(whocanmarkduplicate (members|all_members)|(managers|owners_and_managers)|(managers_only)|(owners|owners_only)|none)|
(whocanmarkfavoritereplyonanytopic (members|all_members)|(managers|owners_and_managers)|(managers_only)|(owners|owners_only)|none)|
(whocanmarkfavoritereplyonowntopic (members|all_members)|(managers|owners_and_managers)|(managers_only)|(owners|owners_only)|none)|
(whocanmarknoresponseneeded (members|all_members)|(managers|owners_and_managers)|(managers_only)|(owners|owners_only)|none)|
(whocanmodifytagsandcategories (members|all_members)|(managers|owners_and_managers)|(managers_only)|(owners|owners_only)|none)|
(whocanpostmessage NONE_CAN_POST|ALL_MANAGERS_CAN_POST|ALL_MEMBERS_CAN_POST|ALL_IN_DOMAIN_CAN_POST|ANYONE_CAN_POST)|
(whocantaketopics ALL_MEMBERS|OWNERS_AND_MANAGERS|MANAGERS_ONLY|OWNERS_ONLY|NONE)|
(whocanunassigntopic ALL_MEMBERS|OWNERS_AND_MANAGERS|MANAGERS_ONLY|OWNERS_ONLY|NONE)|
(whocanunmarkfavoritereplyonanytopic ALL_MEMBERS|OWNERS_AND_MANAGERS|MANAGERS_ONLY|OWNERS_ONLY|NONE)|
(whocantaketopics (members|all_members)|(managers|owners_and_managers)|(managers_only)|(owners|owners_only)|none)|
(whocanunassigntopic (members|all_members)|(managers|owners_and_managers)|(managers_only)|(owners|owners_only)|none)|
(whocanunmarkfavoritereplyonanytopic (members|all_members)|(managers|owners_and_managers)|(managers_only)|(owners|owners_only)|none)|
(whocanviewgroup ANYONE_CAN_VIEW|ALL_IN_DOMAIN_CAN_VIEW|ALL_MEMBERS_CAN_VIEW|ALL_MANAGERS_CAN_VIEW)|
(whocanviewmembership ALL_IN_DOMAIN_CAN_VIEW|ALL_MEMBERS_CAN_VIEW|ALL_MANAGERS_CAN_VIEW)

View File

@@ -7719,17 +7719,15 @@ def doCreateUser():
def GroupIsAbuseOrPostmaster(emailAddr):
return emailAddr.startswith(u'abuse@') or emailAddr.startswith(u'postmaster@')
def mapCollaborativeACL(myarg, value):
value = value.lower().replace(u'_', u'')
if value in COLLABORATIVE_ACL_CHOICES:
return COLLABORATIVE_ACL_CHOICES[value]
systemErrorExit(3, 'allowed choices for %s are %s, got %s' % (myarg, u', '.join(sorted(COLLABORATIVE_ACL_CHOICES)), value))
def getGroupAttrValue(myarg, value, gs_object, gs_body, function):
if myarg == u'collaborative':
value = value.upper()
if value in ['MEMBERS']:
value = 'ALL_MEMBERS'
elif value in ['OWNERS']:
value = 'OWNERS_ONLY'
elif value in ['MANAGERS']:
value = u'OWNERS_AND_MANAGERS'
elif value in ['MANAGERSONLY']:
value = u'MANAGERS_ONLY'
value = mapCollaborativeACL(myarg, value)
for attrName, attrValue in COLLABORATIVE_INBOX_ATTRIBUTES.items():
if attrValue == u'acl':
gs_body[attrName] = value
@@ -7757,6 +7755,8 @@ def getGroupAttrValue(myarg, value, gs_object, gs_body, function):
value = value.replace(u'\\n', u'\n')
elif attrib == u'primaryLanguage':
value = LANGUAGE_CODES_MAP.get(value.lower(), value)
elif COLLABORATIVE_INBOX_ATTRIBUTES.get(attrib) == u'acl':
value = mapCollaborativeACL(myarg, value)
elif params[u'description'].find(value.upper()) != -1: # ugly hack because API wants some values uppercased.
value = value.upper()
elif value.lower() in true_values:

View File

@@ -511,6 +511,16 @@ CROS_END_ARGUMENTS = [u'end', u'enddate']
CROS_TPM_VULN_VERSIONS = [u'41f', u'420', u'628', u'8520',]
CROS_TPM_FIXED_VERSIONS = [u'422', u'62b', u'8521',]
COLLABORATIVE_ACL_CHOICES = {
u'allmembers': u'ALL_MEMBERS',
u'members': u'ALL_MEMBERS',
u'ownersandmanagers': u'OWNERS_AND_MANAGERS',
u'managersonly': u'MANAGERS_ONLY',
u'managers': u'OWNERS_AND_MANAGERS',
u'ownersonly': u'OWNERS_ONLY',
u'owners': u'OWNERS_ONLY',
u'none': u'NONE',
}
COLLABORATIVE_INBOX_ATTRIBUTES = {
u'whoCanAddReferences': u'acl',
u'whoCanAssignTopics': u'acl',