Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Unified Diff: appengine/monorail/proto/usergroup_pb2.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/monorail/proto/user_pb2.py ('k') | appengine/monorail/queue.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « appengine/monorail/proto/user_pb2.py ('k') | appengine/monorail/queue.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698