misp_client_rs/models/
user.rs

1//!
2//! MISP Automation API
3//!
4//!  ### Getting Started  MISP API allows you to query, create, modify data models, such as [Events](https://www.circl.lu/doc/misp/GLOSSARY.html#misp-event), [Objects](https://www.circl.lu/doc/misp/misp-objects/), [Attributes](https://www.circl.lu/doc/misp/GLOSSARY.html#misp-attribute). This is extremly useful for interconnecting MISP with external tools and feeding other systems with threat intel data.  It also lets you perform administrative tasks such as creating users, organisations, altering MISP settings, and much more.  To get an API key there are several options: * **[UI]** Go to [My Profile -> Auth Keys](/auth_keys/index) section and click on `+ Add authentication key`  * **[UI]** As an admin go to the the [Administration -> List Users -> View](/admin/users/view/[id]) page of the user you want to create an auth key for and on the `Auth keys` section click on `+ Add authentication key`  * **[CLI]** Use the following command: `./app/Console/cake user change_authkey [e-mail/user_id]`  * **API** Provided you already have an admin level API key, you can create an API key for another user using the `[POST]/auth_keys/add/{{user_id}}` endpoint.  > **NOTE:** The authentication key will only be displayed once, so take note of it or store it properly in your application secrets.  #### Accept and Content-Type headers  When performing your request, depending on the type of request, you might need to explicitly specify in what content  type you want to get your results. This is done by setting one of the below `Accept` headers:      Accept: application/json     Accept: application/xml  When submitting data in a `POST`, `PUT` or `DELETE` operation you also need to specify in what content-type you encoded the payload.  This is done by setting one of the below `Content-Type` headers:      Content-Type: application/json     Content-Type: application/xml  Example: ``` curl  --header \"Authorization: YOUR_API_KEY\" \\       --header \"Accept: application/json\" \\       --header \"Content-Type: application/json\" https://<misp url>/  ```  > **NOTE**: By appending .json or .xml the content type can also be set without the need for a header.  #### Automation using PyMISP  [PyMISP](https://github.com/MISP/PyMISP) is a Python library to access MISP platforms via their REST [API](https://www.circl.lu/doc/misp/GLOSSARY.html#api). It allows you to fetch events, add or update events/attributes, add or update samples or search for attributes.  ### FAQ * [Dev FAQ](https://www.circl.lu/doc/misp/dev-faq/) * [GitHub project FAQ](https://github.com/MISP/MISP/wiki/Frequently-Asked-Questions) 
5//!
6//! The version of the OpenAPI document: 2.4
7//! 
8//! Generated by: https://openapi-generator.tech
9//! 
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct User {
16    #[serde(rename = "org_id", skip_serializing_if = "Option::is_none")]
17    pub org_id: Option<String>,
18    #[serde(rename = "server_id", skip_serializing_if = "Option::is_none")]
19    pub server_id: Option<String>,
20    #[serde(rename = "email", skip_serializing_if = "Option::is_none")]
21    pub email: Option<String>,
22    #[serde(rename = "autoalert", skip_serializing_if = "Option::is_none")]
23    pub autoalert: Option<bool>,
24    /// API auth key used for the API, only set if MISP setting `Security.advanced_authkeys` is set to `false`.
25    #[serde(rename = "authkey", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
26    pub authkey: Option<Option<String>>,
27    #[serde(rename = "invited_by", skip_serializing_if = "Option::is_none")]
28    pub invited_by: Option<String>,
29    #[serde(rename = "gpgkey", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub gpgkey: Option<Option<String>>,
31    #[serde(rename = "certif_public", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
32    pub certif_public: Option<Option<String>>,
33    #[serde(rename = "nids_sid", skip_serializing_if = "Option::is_none")]
34    pub nids_sid: Option<String>,
35    #[serde(rename = "termsaccepted", skip_serializing_if = "Option::is_none")]
36    pub termsaccepted: Option<bool>,
37    #[serde(rename = "newsread", skip_serializing_if = "Option::is_none")]
38    pub newsread: Option<String>,
39    #[serde(rename = "role_id", skip_serializing_if = "Option::is_none")]
40    pub role_id: Option<String>,
41    /// Password change required.
42    #[serde(rename = "change_pw", skip_serializing_if = "Option::is_none")]
43    pub change_pw: Option<ChangePw>,
44    #[serde(rename = "contactalert", skip_serializing_if = "Option::is_none")]
45    pub contactalert: Option<bool>,
46    #[serde(rename = "disabled", skip_serializing_if = "Option::is_none")]
47    pub disabled: Option<bool>,
48    #[serde(rename = "expiration", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
49    pub expiration: Option<Option<String>>,
50    #[serde(rename = "current_login", skip_serializing_if = "Option::is_none")]
51    pub current_login: Option<String>,
52    #[serde(rename = "last_login", skip_serializing_if = "Option::is_none")]
53    pub last_login: Option<String>,
54    #[serde(rename = "force_logout", skip_serializing_if = "Option::is_none")]
55    pub force_logout: Option<bool>,
56    #[serde(rename = "date_created", skip_serializing_if = "Option::is_none")]
57    pub date_created: Option<String>,
58    #[serde(rename = "date_modified", skip_serializing_if = "Option::is_none")]
59    pub date_modified: Option<String>,
60    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
61    pub id: Option<String>,
62}
63
64impl User {
65    pub fn new() -> User {
66        User {
67            org_id: None,
68            server_id: None,
69            email: None,
70            autoalert: None,
71            authkey: None,
72            invited_by: None,
73            gpgkey: None,
74            certif_public: None,
75            nids_sid: None,
76            termsaccepted: None,
77            newsread: None,
78            role_id: None,
79            change_pw: None,
80            contactalert: None,
81            disabled: None,
82            expiration: None,
83            current_login: None,
84            last_login: None,
85            force_logout: None,
86            date_created: None,
87            date_modified: None,
88            id: None,
89        }
90    }
91}
92/// Password change required.
93#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
94pub enum ChangePw {
95    #[serde(rename = "0")]
96    Variant0,
97    #[serde(rename = "1")]
98    Variant1,
99}
100
101impl Default for ChangePw {
102    fn default() -> ChangePw {
103        Self::Variant0
104    }
105}
106