Skip to content

Commit 9fe5af0

Browse files
committed
only allow idc user call profile
1 parent 2bda8e4 commit 9fe5af0

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

crates/chat-cli/src/auth/builder_id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ pub async fn is_idc_user(database: &Database) -> Result<bool> {
621621
if let Ok(Some(token)) = BuilderIdToken::load(database).await {
622622
Ok(token.token_type() == TokenType::IamIdentityCenter)
623623
} else {
624-
Err(eyre!("No auth token found - is the user signed in?"))
624+
Ok(false)
625625
}
626626
}
627627

crates/chat-cli/src/cli/user.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use crate::auth::builder_id::{
3232
BuilderIdToken,
3333
PollCreateToken,
3434
TokenType,
35+
is_idc_user,
3536
poll_create_token,
3637
start_device_authorization,
3738
};
@@ -338,10 +339,8 @@ pub enum LicenseType {
338339
}
339340

340341
pub async fn profile(os: &mut Os) -> Result<ExitCode> {
341-
if let Ok(Some(token)) = BuilderIdToken::load(&os.database).await {
342-
if matches!(token.token_type(), TokenType::BuilderId) {
343-
bail!("This command is only available for Pro users");
344-
}
342+
if !is_idc_user(&os.database).await? {
343+
bail!("This command is only available for IAM Identity Center users");
345344
}
346345

347346
select_profile_interactive(os, false).await?;

0 commit comments

Comments
 (0)