Function create_group

Source
pub async fn create_group<'a>(
    virtual_file_system: &'a VirtualFileSystem<'a>,
    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. Adding the group to the Users manager
  3. Creating the group file with the group data

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(Group_identifier_type) 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)