| Index: appengine/monorail/proto/usergroup_pb2.py
|
| diff --git a/appengine/monorail/proto/usergroup_pb2.py b/appengine/monorail/proto/usergroup_pb2.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bea5a1ae158690ce0163e7c892cfb172d9b3b0e5
|
| --- /dev/null
|
| +++ b/appengine/monorail/proto/usergroup_pb2.py
|
| @@ -0,0 +1,46 @@
|
| +# Copyright 2016 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is govered by a BSD-style
|
| +# license that can be found in the LICENSE file or at
|
| +# https://developers.google.com/open-source/licenses/bsd
|
| +
|
| +"""Protocol buffers for Monorail usergroups."""
|
| +
|
| +from protorpc import messages
|
| +
|
| +
|
| +class MemberVisibility(messages.Enum):
|
| + """Enum controlling who can see the members of a user group."""
|
| + OWNERS = 0
|
| + MEMBERS = 1
|
| + ANYONE = 2
|
| +
|
| +
|
| +class GroupType(messages.Enum):
|
| + """Type of external group to import."""
|
| + CHROME_INFRA_AUTH = 0
|
| + MDB = 1
|
| + BAGGINS = 3
|
| +
|
| +
|
| +class UserGroupSettings(messages.Message):
|
| + """In-memory busines object for representing user group settings."""
|
| + who_can_view_members = messages.EnumField(
|
| + MemberVisibility, 1, default=MemberVisibility.MEMBERS)
|
| + ext_group_type = messages.EnumField(GroupType, 2)
|
| + last_sync_time = messages.IntegerField(
|
| + 3, default=0, variant=messages.Variant.INT32)
|
| + friend_projects = messages.IntegerField(
|
| + 4, repeated=True, variant=messages.Variant.INT32)
|
| +# TODO(jrobbins): add settings to control who can join, etc.
|
| +
|
| +
|
| +def MakeSettings(who_can_view_members_str, ext_group_type_str=None,
|
| + last_sync_time=0, friend_projects=[]):
|
| + """Create and return a new user record in RAM."""
|
| + settings = UserGroupSettings(
|
| + who_can_view_members=MemberVisibility(who_can_view_members_str.upper()))
|
| + if ext_group_type_str:
|
| + settings.ext_group_type = GroupType(ext_group_type_str.upper())
|
| + settings.last_sync_time = last_sync_time
|
| + settings.friend_projects = friend_projects
|
| + return settings
|
|
|