From 7633935ec447805a756d7658449c544be63ee323 Mon Sep 17 00:00:00 2001 From: Rob Tucker Date: Thu, 9 Sep 2021 07:38:57 -0400 Subject: [PATCH 1/2] adding ghe_group_curators to list of NDA_GROUPS --- .github/workflows/rust.yml | 10 ++++++++-- Cargo.lock | 7 ++++--- Cargo.toml | 1 + src/db/users.rs | 10 ++++------ src/rules/functions.rs | 7 ++++++- 5 files changed, 23 insertions(+), 12 deletions(-) mode change 100644 => 100755 src/db/users.rs diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 802b9a6..4719a7c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -13,7 +13,7 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 services: postgres: @@ -28,7 +28,13 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Run fmt + - name: Install Rust 1.46.0 + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.46.0 + override: true + components: rustfmt, clippy + - name: FMT run: cargo fmt --all -- --check - name: Clippy run: cargo clippy --all --all-features -- -D warnings diff --git a/Cargo.lock b/Cargo.lock index 302204f..aeaffd7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -849,6 +849,7 @@ dependencies = [ "failure_derive", "futures", "lazy_static", + "lexical-core", "log", "r2d2", "rusoto_core", @@ -1428,13 +1429,13 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lexical-core" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db65c6da02e61f55dae90a0ae427b2a5f6b3e8db09f58d10efab23af92592616" +checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" dependencies = [ "arrayvec", "bitflags", - "cfg-if 0.1.10", + "cfg-if 1.0.0", "ryu", "static_assertions", ] diff --git a/Cargo.toml b/Cargo.toml index b74551b..89ddc5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ dino_park_gate = { git = "https://github.com/mozilla-iam/dino-park-gate", branch dino_park_guard = { git = "https://github.com/mozilla-iam/dino-park-guard", branch = "0.3", version = "0.3" } dino_park_trust = { git = "https://github.com/mozilla-iam/dino-park-trust", tag = "0.0.7", version = "0.0.7" } diesel = { version = "1.4", features = ["postgres", "uuidv07", "r2d2", "chrono", "serde_json"] } +lexical-core = "0.7.5" diesel_migrations = "1.4" actix-web = "3" actix-rt = "1" diff --git a/src/db/users.rs b/src/db/users.rs old mode 100644 new mode 100755 index 91fe2ec..e17adb7 --- a/src/db/users.rs +++ b/src/db/users.rs @@ -143,7 +143,7 @@ macro_rules! user_t { ($user_typ:ident, $table:expr, $display:expr) => { #[derive(Identifiable, Queryable, PartialEq, Debug, Insertable, AsChangeset)] #[primary_key(user_uuid)] - #[changeset_options(treat_none_as_null="true")] + #[changeset_options(treat_none_as_null = "true")] #[table_name = $table] pub struct $user_typ { pub user_uuid: Uuid, @@ -171,17 +171,15 @@ macro_rules! user_t { impl From<&Profile> for $user_typ { fn from(profile: &Profile) -> $user_typ { $user_typ { - user_uuid: Uuid::parse_str( - &profile.uuid.value.clone().unwrap_or_default() - ).unwrap_or_default(), + user_uuid: Uuid::parse_str(&profile.uuid.value.clone().unwrap_or_default()) + .unwrap_or_default(), picture: field_for_display(&profile.picture, &$display), first_name: field_for_display(&profile.first_name, &$display), last_name: field_for_display(&profile.last_name, &$display), username: profile.primary_username.value.clone().unwrap_or_default(), email: field_for_display(&profile.primary_email, &$display), - trust: trust_for_profile(profile) + trust: trust_for_profile(profile), } - } } }; diff --git a/src/rules/functions.rs b/src/rules/functions.rs index 814400a..ef9353b 100644 --- a/src/rules/functions.rs +++ b/src/rules/functions.rs @@ -5,7 +5,12 @@ use crate::rules::RuleContext; use crate::utils::valid_group_name; use dino_park_trust::GroupsTrust; -const NDA_GROUPS: [&str; 2] = ["nda", "contingentworkernda"]; +/* +The other places these groups are handled. +https://github.com/mozilla-iam/dino-park-gate/pull/3 +https://github.com/mozilla-iam/dino-park-front-end/pull/662 +*/ +const NDA_GROUPS: [&str; 3] = ["nda", "contingentworkernda", "ghe_group_curators"]; pub fn is_nda_group(group_name: &str) -> bool { NDA_GROUPS.contains(&group_name) From eb801a8d63a1ded36fa6ac48ed5b87de056e62fb Mon Sep 17 00:00:00 2001 From: Rob Tucker Date: Thu, 16 Sep 2021 06:51:09 -0400 Subject: [PATCH 2/2] Upping dino_park_gate to 0.8.1 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 89ddc5e..d65f19d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ local = ["dino_park_gate/localuserscope"] [dependencies] cis_client = { git = "https://github.com/mozilla-iam/cis_client-rust", branch = "0.7", version = "0.7" } cis_profile = { git = "https://github.com/mozilla-iam/cis_profile-rust", branch = "0.4", version = "0.4", features = ["aws", "vendored"] } -dino_park_gate = { git = "https://github.com/mozilla-iam/dino-park-gate", branch = "0.8", version = "0.8" } +dino_park_gate = { git = "https://github.com/mozilla-iam/dino-park-gate", branch = "0.8.1", version = "0.8.1" } dino_park_guard = { git = "https://github.com/mozilla-iam/dino-park-guard", branch = "0.3", version = "0.3" } dino_park_trust = { git = "https://github.com/mozilla-iam/dino-park-trust", tag = "0.0.7", version = "0.0.7" } diesel = { version = "1.4", features = ["postgres", "uuidv07", "r2d2", "chrono", "serde_json"] }