avm99963 | 83f8f29 | 2021-08-24 18:26:52 +0200 | [diff] [blame] | 1 | syntax = "proto3"; |
| 2 | |
| 3 | import "api_proto/common.proto"; |
| 4 | import "google/protobuf/timestamp.proto"; |
| 5 | |
| 6 | option go_package = "gomodules.avm99963.com/twpt-server/api_proto"; |
| 7 | |
| 8 | message Feature { |
| 9 | int32 id = 1; |
| 10 | string codename = 2; |
| 11 | enum Type { |
| 12 | TYPE_UNKNOWN = 0; |
| 13 | TYPE_EXPERIMENT = 1; |
| 14 | TYPE_OPTION = 2; |
Adrià Vilanova Martínez | dc5d29f | 2023-04-15 17:22:13 +0200 | [diff] [blame^] | 15 | TYPE_INTERNAL_KILL_SWITCH = 3; |
avm99963 | 83f8f29 | 2021-08-24 18:26:52 +0200 | [diff] [blame] | 16 | TYPE_DEPRECATED = 10; |
| 17 | } |
| 18 | Type type = 3; |
| 19 | } |
| 20 | |
| 21 | message KillSwitch { |
| 22 | int32 id = 1; |
| 23 | Feature feature = 2; |
| 24 | string min_version = 3; |
| 25 | string max_version = 4; |
| 26 | repeated Environment.Browser browsers = 5; |
| 27 | bool active = 6; |
| 28 | } |
| 29 | |
| 30 | message KillSwitchAuthorizedUser { |
| 31 | int32 id = 1; |
| 32 | string google_uid = 2; |
| 33 | string email = 3; |
| 34 | enum AccessLevel { |
| 35 | ACCESS_LEVEL_NONE = 0; |
Adrià Vilanova Martínez | c147b6a | 2021-09-01 17:25:38 +0200 | [diff] [blame] | 36 | ACCESS_LEVEL_ACTIVATOR = 5; // The user may enable/disable kill switches. |
| 37 | ACCESS_LEVEL_ADMIN = 10; // The user may perform any action. |
avm99963 | 83f8f29 | 2021-08-24 18:26:52 +0200 | [diff] [blame] | 38 | } |
| 39 | AccessLevel access_level = 4; |
| 40 | } |
| 41 | |
| 42 | message KillSwitchTransformation { |
Adrià Vilanova Martínez | 25e1211 | 2021-08-25 13:48:06 +0200 | [diff] [blame] | 43 | KillSwitch old = 1; |
| 44 | KillSwitch new = 2; |
| 45 | } |
| 46 | |
| 47 | message AuthorizedUserTransformation { |
| 48 | KillSwitchAuthorizedUser old = 1; |
| 49 | KillSwitchAuthorizedUser new = 2; |
avm99963 | 83f8f29 | 2021-08-24 18:26:52 +0200 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | // Log entry which describes an action which has taken place. |
| 53 | message KillSwitchAuditLogEntry { |
| 54 | // Timestamp in which the action was taken. |
| 55 | google.protobuf.Timestamp timestamp = 1; |
| 56 | |
| 57 | // User who/which performed the action. |
| 58 | KillSwitchAuthorizedUser user = 2; |
| 59 | |
| 60 | message KillSwitchEnabled { |
Adrià Vilanova Martínez | 25e1211 | 2021-08-25 13:48:06 +0200 | [diff] [blame] | 61 | KillSwitch kill_switch = 1; |
avm99963 | 83f8f29 | 2021-08-24 18:26:52 +0200 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | message KillSwitchDisabled { |
| 65 | KillSwitchTransformation transformation = 1; |
| 66 | } |
| 67 | |
Adrià Vilanova Martínez | 25e1211 | 2021-08-25 13:48:06 +0200 | [diff] [blame] | 68 | message AuthorizedUserAdded { |
| 69 | KillSwitchAuthorizedUser user = 1; |
| 70 | } |
| 71 | |
| 72 | message AuthorizedUserUpdated { |
| 73 | AuthorizedUserTransformation transformation = 1; |
| 74 | } |
| 75 | |
| 76 | message AuthorizedUserDeleted { |
| 77 | KillSwitchAuthorizedUser old_user = 1; |
| 78 | } |
| 79 | |
avm99963 | 83f8f29 | 2021-08-24 18:26:52 +0200 | [diff] [blame] | 80 | // Description of the action taken |
| 81 | oneof description { |
| 82 | KillSwitchEnabled kill_switch_enabled = 3; |
| 83 | KillSwitchDisabled kill_switch_disabled = 4; |
Adrià Vilanova Martínez | 25e1211 | 2021-08-25 13:48:06 +0200 | [diff] [blame] | 84 | AuthorizedUserAdded authorized_user_added = 5; |
| 85 | AuthorizedUserUpdated authorized_user_updated = 6; |
| 86 | AuthorizedUserDeleted authorized_user_deleted = 7; |
avm99963 | 83f8f29 | 2021-08-24 18:26:52 +0200 | [diff] [blame] | 87 | } |
| 88 | } |