blob: b9c9f500d2929a96aac6518e62dc9183dc149eae [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001// Copyright 2020 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file or at
4// https://developers.google.com/open-source/licenses/bsd
5
6// This file defines protobufs for users and related business
7// objects, e.g., users, user preferences.
8
9syntax = "proto3";
10
11package monorail.v3;
12
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +020013option go_package = "infra/monorailv2/api/v3/api_proto";
Copybara854996b2021-09-07 19:36:02 +000014
15import "google/api/resource.proto";
16import "google/api/field_behavior.proto";
17
18// User represents a user of the Monorail site.
19// Next available tag: 5
20message User {
21 option (google.api.resource) = {
22 type: "api.crbug.com/User"
23 pattern: "users/{user_id}"
24 };
25 // Resource name of the user.
26 // The API will always return User names with format: users/<user_id>.
27 // However the API will accept User names with formats: users/<user_id> or users/<email>.
28 // To fetch the display_name for any users/<user_id> returned by the API,
29 // you can call {Batch}GetUser{s}.
30 // We represent deleted users within Monorail with `users/1` or `users/2103649657`.
31 string name = 1;
32 // User display_name to show other users using the site.
33 // By default this is the obscured or un-obscured email.
34 string display_name = 2;
35 // Obscured or un-obscured user email or empty if this represents
36 // a deleted user.
37 string email = 4 [ (google.api.field_behavior) = OUTPUT_ONLY ];
38 // User-written indication of their availability or working hours.
39 string availability_message = 3;
Adrià Vilanova Martínezac4a6442022-05-15 19:05:13 +020040 // Timestamp of the user's last visit
41 int32 last_visit_timestamp = 5;
Copybara854996b2021-09-07 19:36:02 +000042}
43
44
45// UserSettings represents preferences and account settings of a User.
46// Next available tag: 8
47message UserSettings {
48 option (google.api.resource) = {
49 type: "api.crbug.com/UserSettings"
50 pattern: "usersettings/{user_id}"
51 };
52
53 // Potential roles of a user.
54 // Next available tag: 3
55 enum SiteRole {
56 // Default value. This value is unused.
57 SITE_ROLE_UNSPECIFIED = 0;
58 // Normal site user with no special site-wide extra permissions.
59 NORMAL = 1;
60 // Site-wide admin role.
61 ADMIN = 2;
62 }
63
64 // The access the user has to the site.
65 // Next available tag: 3
66 message SiteAccess {
67 // Potential status of a user's access to the site.
68 // Next available tag: 3
69 enum Status {
70 // Default value. This value is unused.
71 STATUS_UNSPECIFIED = 0;
72 // The user has access to the site.
73 FULL_ACCESS = 1;
74 // The user is banned from the site.
75 BANNED = 2;
76 }
77
78 // The status of the user's access to the site.
79 Status status = 1;
80 // An explanation for the value of `status`.
81 string reason = 2;
82 }
83
84 // Trait options for notifications the user receives.
85 // Next available tag: 6;
86 enum NotificationTraits {
87 // Default value. This value is unused.
88 NOTIFICATION_TRAITS_UNSPECIFIED = 0;
89 // Send change notifications for issues where user is owner or cc.
90 NOTIFY_ON_OWNED_OR_CC_ISSUE_CHANGES = 1;
91 // Send change notifications for issues the user has starred.
92 NOTIFY_ON_STARRED_ISSUE_CHANGES = 2;
93 // Send date-type field notifications for issues the user has starred.
94 // See monorail/doc/userguide/email.md#why-did-i-get-a-follow_up-email-notification.
95 NOTIFY_ON_STARRED_NOTIFY_DATES = 3;
96 // Email subject lines should be compact.
97 COMPACT_SUBJECT_LINE = 4;
98 // Include a button link to the issue, in Gmail.
99 GMAIL_INCLUDE_ISSUE_LINK_BUTTON = 5;
100 }
101
102 // Privacy trait options for the user.
103 // Next available tag: 2
104 enum PrivacyTraits {
105 // Default value. This value is unused.
106 PRIVACY_TRAITS_UNSPECIFIED = 0;
107 // Obscure the user's email from non-project members throughout the site.
108 OBSCURE_EMAIL = 1;
109 }
110
111 // Site interaction trait options for the user.
112 // Next available tag: 3
113 enum SiteInteractionTraits {
114 // Default value. This value is unused.
115 SITE_INTERACTION_TRAITS_UNSPECIFIED = 0;
116 // Add 'Restrict-View-Google' labels to new issues the user reports.
117 // Issues will only be visible to the user (issue reporter)
118 // and users with the `Google` permission.
119 REPORT_RESTRICT_VIEW_GOOGLE_ISSUES = 1;
120 // When viewing public issues, show a banner to remind the user not
121 // to post sensitive information.
122 PUBLIC_ISSUE_BANNER = 2;
123 }
124
125 // Resource name of the user that has these settings.
126 string name = 1 [ (google.api.resource_reference) = {type: "api.crbug.com/UserSettings"} ];
127 // The global site role for the user.
128 SiteRole site_role = 2 [ (google.api.field_behavior) = OUTPUT_ONLY ];
129 // Resource name of linked secondary users.
130 repeated string linked_secondary_users = 3 [
131 (google.api.resource_reference) = {type: "api.crbug.com/User"},
132 (google.api.field_behavior) = OUTPUT_ONLY ];
133 // The user's access to the site.
134 SiteAccess site_access = 4 [ (google.api.field_behavior) = OUTPUT_ONLY ];
135 // Notification trait preferences of the user.
136 repeated NotificationTraits notification_traits = 5;
137 // Privacy trait preferences of the user.
138 repeated PrivacyTraits privacy_traits = 6;
139 // Site interaction trait preferences of the user.
140 repeated SiteInteractionTraits site_interaction_traits = 7;
141}
142
143// Defines saved queries that belong to a user.
144//
145// Next available tag: 6
146message UserSavedQuery {
147 option (google.api.resource) = {
148 type: "api.crbug.com/UserSavedQuery"
149 pattern: "users/{user_id}/savedQueries/{saved_query_id}"
150 };
151
152 // Resource name of this saved query.
153 string name = 1;
154 // Display name of this saved query, ie 'open issues'.
155 string display_name = 2;
156 // Search term of this saved query.
157 string query = 3;
158 // List of projects this query can be searched in.
159 repeated string projects = 4 [
160 (google.api.resource_reference) = { type: "api.crbug.com/Project" }
161 ];
162 // Subscription mode of this saved query
163 // Next available tag: 3
164 enum SubscriptionMode {
165 // Default API value. This value is unused.
166 SUBSCRIPTION_MODE_UNSPECIFIED = 0;
167 // Do not subscribe to notifications.
168 NO_NOTIFICATION = 1;
169 // Subscribe to notifications.
170 IMMEDIATE_NOTIFICATION = 2;
171 }
172 SubscriptionMode subscription_mode = 5;
173}
174
175// A project starred by a user.
176//
177// Next available tag: 2
178message ProjectStar {
179 option (google.api.resource) = {
180 type: "api.crbug.com/ProjectStar"
181 pattern: "users/{user_id}/projectStars/{project_name}"
182 };
183 // Resource name of the ProjectStar.
184 string name = 1;
185}