Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #34 from adamgfraser/whitelist
Browse files Browse the repository at this point in the history
Delete Whitelist Role
  • Loading branch information
adamgfraser committed Oct 30, 2023
2 parents f6def09 + 8429b09 commit 6fd747e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/clients/grant.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use core::panic;

use async_trait::async_trait;
use tracing::info;

Expand Down Expand Up @@ -106,11 +108,11 @@ impl<C: golem_client::grant::Grant + Send + Sync> GrantClient for GrantClientLiv
fn api_to_cli(role: golem_client::model::Role) -> Role {
match role {
golem_client::model::Role::Admin {} => Role::Admin,
golem_client::model::Role::WhitelistAdmin {} => Role::WhitelistAdmin,
golem_client::model::Role::MarketingAdmin {} => Role::MarketingAdmin,
golem_client::model::Role::ViewProject {} => Role::ViewProject,
golem_client::model::Role::DeleteProject {} => Role::DeleteProject,
golem_client::model::Role::CreateProject {} => Role::CreateProject,
golem_client::model::Role::InstanceServer {} => Role::InstanceServer,
_ => panic!("Unknown role"),
}
}
13 changes: 1 addition & 12 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use golem_client::template::TemplateError;
use golem_client::token::TokenError;
use golem_client::worker::WorkerError;
use golem_examples::model::{Example, ExampleName, GuestLanguage, GuestLanguageTier};
use indoc::indoc;
use serde::{Deserialize, Serialize};
use strum::IntoEnumIterator;
use strum_macros::EnumIter;
Expand Down Expand Up @@ -141,20 +140,13 @@ impl From<LoginError> for GolemError {
let joined = errors.join(", ");
GolemError(format!("Invalid request: {joined}"))
}
LoginError::Status403 { .. } => {
let msg = indoc! {"
At the moment account creation is restricted.
None of your verified emails is whitelisted.
Please contact us to create an account.
"};
GolemError(msg.to_string())
}
LoginError::Status500 { error } => {
GolemError(format!("Internal server error on Login: {error}"))
}
LoginError::Status401 { error } => {
GolemError(format!("External service call error on Login: {error}"))
}
_ => GolemError("Unexpected error on Login".to_string()),
}
}
}
Expand Down Expand Up @@ -550,7 +542,6 @@ pub enum TemplateIdOrName {
#[derive(Copy, Clone, PartialEq, Eq, Debug, EnumIter, Serialize, Deserialize)]
pub enum Role {
Admin,
WhitelistAdmin,
MarketingAdmin,
ViewProject,
DeleteProject,
Expand All @@ -562,7 +553,6 @@ impl Display for Role {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let s = match self {
Role::Admin => "Admin",
Role::WhitelistAdmin => "WhitelistAdmin",
Role::MarketingAdmin => "MarketingAdmin",
Role::ViewProject => "ViewProject",
Role::DeleteProject => "DeleteProject",
Expand All @@ -580,7 +570,6 @@ impl FromStr for Role {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"Admin" => Ok(Role::Admin),
"WhitelistAdmin" => Ok(Role::WhitelistAdmin),
"MarketingAdmin" => Ok(Role::MarketingAdmin),
"ViewProject" => Ok(Role::ViewProject),
"DeleteProject" => Ok(Role::DeleteProject),
Expand Down

0 comments on commit 6fd747e

Please sign in to comment.