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

Commit

Permalink
delete whitelist role
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgfraser committed Oct 30, 2023
1 parent 6842b4c commit 3c0dfa1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 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"),
}
}
12 changes: 1 addition & 11 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,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(format!("Unexpected error on Login")),
}
}
}
Expand Down Expand Up @@ -550,7 +543,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 +554,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 +571,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 3c0dfa1

Please sign in to comment.