Commit c5bca5dd authored by Brad King's avatar Brad King

types: Restore is_admin on User and UserPublic

GitLab 9.3 restored the `is_admin` field of users if the querying
user is itself an admin.  Make it an Option so that the API works
for both admin and non-admin users.
parent e5a23653
......@@ -483,6 +483,7 @@ fn test_read_user() {
assert_eq!(user.created_at,
Utc.ymd(2015, 2, 26)
.and_hms_milli(15, 58, 34, 670));
assert_eq!(user.is_admin, None);
assert_eq!(user.bio, Some("".to_string()));
assert_eq!(user.location, None);
assert_eq!(user.skype, "");
......@@ -507,6 +508,7 @@ fn test_read_user_public() {
assert_eq!(user_public.created_at,
Utc.ymd(2015, 2, 26)
.and_hms_milli(15, 58, 34, 670));
assert_eq!(user_public.is_admin, None);
assert_eq!(user_public.bio, Some("".to_string()));
assert_eq!(user_public.location, None);
assert_eq!(user_public.skype, "");
......
......@@ -95,6 +95,9 @@ pub struct User {
pub web_url: String,
/// When the account was created.
pub created_at: DateTime<Utc>,
/// Whether the user is an administrator or not.
/// Only available when talking to GitLab as an admin.
pub is_admin: Option<bool>,
/// Self-described biography of the user.
pub bio: Option<String>,
/// Geographic location of the user.
......@@ -165,6 +168,9 @@ pub struct UserPublic {
pub web_url: String,
/// When the account was created.
pub created_at: DateTime<Utc>,
/// Whether the user is an administrator or not.
/// Only available when talking to GitLab as an admin.
pub is_admin: Option<bool>,
/// Self-described biography of the user.
pub bio: Option<String>,
/// Geographic location of the user.
......@@ -233,6 +239,7 @@ impl From<UserPublic> for User {
avatar_url: user.avatar_url,
web_url: user.web_url,
created_at: user.created_at,
is_admin: user.is_admin,
bio: user.bio,
location: user.location,
skype: user.skype,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment