blob: 958efbc606f54fb02e4a6f19bf3a59cc4e527790 [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
13option go_package = "api/v3/api_proto";
14
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;
40}
41
42
43// UserSettings represents preferences and account settings of a User.
44// Next available tag: 8
45message UserSettings {
46 option (google.api.resource) = {
47 type: "api.crbug.com/UserSettings"
48 pattern: "usersettings/{user_id}"
49 };
50
51 // Potential roles of a user.
52 // Next available tag: 3
53 enum SiteRole {
54 // Default value. This value is unused.
55 SITE_ROLE_UNSPECIFIED = 0;
56 // Normal site user with no special site-wide extra permissions.
57 NORMAL = 1;
58 // Site-wide admin role.
59 ADMIN = 2;
60 }
61
62 // The access the user has to the site.
63 // Next available tag: 3
64 message SiteAccess {
65 // Potential status of a user's access to the site.
66 // Next available tag: 3
67 enum Status {
68 // Default value. This value is unused.
69 STATUS_UNSPECIFIED = 0;
70 // The user has access to the site.
71 FULL_ACCESS = 1;
72 // The user is banned from the site.
73 BANNED = 2;
74 }
75
76 // The status of the user's access to the site.
77 Status status = 1;
78 // An explanation for the value of `status`.
79 string reason = 2;
80 }
81
82 // Trait options for notifications the user receives.
83 // Next available tag: 6;
84 enum NotificationTraits {
85 // Default value. This value is unused.
86 NOTIFICATION_TRAITS_UNSPECIFIED = 0;
87 // Send change notifications for issues where user is owner or cc.
88 NOTIFY_ON_OWNED_OR_CC_ISSUE_CHANGES = 1;
89 // Send change notifications for issues the user has starred.
90 NOTIFY_ON_STARRED_ISSUE_CHANGES = 2;
91 // Send date-type field notifications for issues the user has starred.
92 // See monorail/doc/userguide/email.md#why-did-i-get-a-follow_up-email-notification.
93 NOTIFY_ON_STARRED_NOTIFY_DATES = 3;
94 // Email subject lines should be compact.
95 COMPACT_SUBJECT_LINE = 4;
96 // Include a button link to the issue, in Gmail.
97 GMAIL_INCLUDE_ISSUE_LINK_BUTTON = 5;
98 }
99
100 // Privacy trait options for the user.
101 // Next available tag: 2
102 enum PrivacyTraits {
103 // Default value. This value is unused.
104 PRIVACY_TRAITS_UNSPECIFIED = 0;
105 // Obscure the user's email from non-project members throughout the site.
106 OBSCURE_EMAIL = 1;
107 }
108
109 // Site interaction trait options for the user.
110 // Next available tag: 3
111 enum SiteInteractionTraits {
112 // Default value. This value is unused.
113 SITE_INTERACTION_TRAITS_UNSPECIFIED = 0;
114 // Add 'Restrict-View-Google' labels to new issues the user reports.
115 // Issues will only be visible to the user (issue reporter)
116 // and users with the `Google` permission.
117 REPORT_RESTRICT_VIEW_GOOGLE_ISSUES = 1;
118 // When viewing public issues, show a banner to remind the user not
119 // to post sensitive information.
120 PUBLIC_ISSUE_BANNER = 2;
121 }
122
123 // Resource name of the user that has these settings.
124 string name = 1 [ (google.api.resource_reference) = {type: "api.crbug.com/UserSettings"} ];
125 // The global site role for the user.
126 SiteRole site_role = 2 [ (google.api.field_behavior) = OUTPUT_ONLY ];
127 // Resource name of linked secondary users.
128 repeated string linked_secondary_users = 3 [
129 (google.api.resource_reference) = {type: "api.crbug.com/User"},
130 (google.api.field_behavior) = OUTPUT_ONLY ];
131 // The user's access to the site.
132 SiteAccess site_access = 4 [ (google.api.field_behavior) = OUTPUT_ONLY ];
133 // Notification trait preferences of the user.
134 repeated NotificationTraits notification_traits = 5;
135 // Privacy trait preferences of the user.
136 repeated PrivacyTraits privacy_traits = 6;
137 // Site interaction trait preferences of the user.
138 repeated SiteInteractionTraits site_interaction_traits = 7;
139}
140
141// Defines saved queries that belong to a user.
142//
143// Next available tag: 6
144message UserSavedQuery {
145 option (google.api.resource) = {
146 type: "api.crbug.com/UserSavedQuery"
147 pattern: "users/{user_id}/savedQueries/{saved_query_id}"
148 };
149
150 // Resource name of this saved query.
151 string name = 1;
152 // Display name of this saved query, ie 'open issues'.
153 string display_name = 2;
154 // Search term of this saved query.
155 string query = 3;
156 // List of projects this query can be searched in.
157 repeated string projects = 4 [
158 (google.api.resource_reference) = { type: "api.crbug.com/Project" }
159 ];
160 // Subscription mode of this saved query
161 // Next available tag: 3
162 enum SubscriptionMode {
163 // Default API value. This value is unused.
164 SUBSCRIPTION_MODE_UNSPECIFIED = 0;
165 // Do not subscribe to notifications.
166 NO_NOTIFICATION = 1;
167 // Subscribe to notifications.
168 IMMEDIATE_NOTIFICATION = 2;
169 }
170 SubscriptionMode subscription_mode = 5;
171}
172
173// A project starred by a user.
174//
175// Next available tag: 2
176message ProjectStar {
177 option (google.api.resource) = {
178 type: "api.crbug.com/ProjectStar"
179 pattern: "users/{user_id}/projectStars/{project_name}"
180 };
181 // Resource name of the ProjectStar.
182 string name = 1;
183}