Skip to main content

create_group

Function create_group 

Source
pub async fn create_group(
    context: &Context<'_>,
    group_name: &str,
    group_identifier: Option<GroupIdentifier>,
) -> Result<GroupIdentifier>
Expand description

Creates a new group with the specified parameters.

This function creates a new group in the system by:

  1. Generating a new group identifier (if not provided)
  2. Creating the group record
  3. Adding the group to the Users manager

The group is created with an empty user list initially.

§Arguments

  • Virtual_file_system - Reference to the virtual file system
  • Group_name - Name for the new group
  • Group_identifier - Optional specific group identifier (auto-generated if None)

§Returns

Returns Ok(GroupIdentifier) with the new group’s identifier, or an appropriate error if creation fails.

§Errors

This function can fail for various reasons including:

  • Group identifier generation or assignment failures
  • File system operations (directory creation, file writing)
  • Users manager operations (adding group)