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