MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / create

Function create

src/mz/src/command/user.rs:36–55  ·  view source on GitHub ↗

Creates a user in the profile organization.

(
    cx: &ProfileContext,
    CreateArgs { email, name }: CreateArgs<'_>,
)

Source from the content-addressed store, hash-verified

34
35/// Creates a user in the profile organization.
36pub async fn create(
37 cx: &ProfileContext,
38 CreateArgs { email, name }: CreateArgs<'_>,
39) -> Result<(), Error> {
40 let loading_spinner = cx.output_formatter().loading_spinner("Creating user...");
41 let roles = cx.admin_client().list_roles().await?;
42 let role_ids = roles.into_iter().map(|role| role.id).collect();
43
44 cx.admin_client()
45 .create_user(CreateUserRequest {
46 email: email.to_string(),
47 name: name.to_string(),
48 provider: "local".to_string(),
49 role_ids,
50 })
51 .await?;
52
53 loading_spinner.finish_with_message("User created.");
54 Ok(())
55}
56
57/// Lists all the users in the profile organization.
58pub async fn list(cx: &ProfileContext) -> Result<(), Error> {

Callers 15

update_cache_fileMethod · 0.50
runFunction · 0.50
runFunction · 0.50
runFunction · 0.50
create_tracing_log_fileFunction · 0.50
zip_debug_folderFunction · 0.50
dump_request_to_fileMethod · 0.50
_dumpMethod · 0.50
export_pod_logsMethod · 0.50
copy_relation_to_csvFunction · 0.50
write_outputFunction · 0.50

Calls 9

loading_spinnerMethod · 0.80
output_formatterMethod · 0.80
list_rolesMethod · 0.80
admin_clientMethod · 0.80
create_userMethod · 0.80
collectMethod · 0.45
mapMethod · 0.45
into_iterMethod · 0.45
to_stringMethod · 0.45

Tested by 3

mainFunction · 0.40
mainFunction · 0.40
runFunction · 0.40