sharepoint online – Show or hide SPFx extension based on user permissions


I like to show or hide extension as per user permission in SPFx ,suppose if user present in SP-group extension is visible or hide it

 @override
  public onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void {
    var Libraryurl = this.context.pageContext.list.title; 
   
    
    const compareTwoCommand: Command = this.tryGetCommand('COMMAND_2');
    if (compareTwoCommand) {
      // This command should be hidden unless exactly one row is selected.
      const listname:string =this.context.pageContext.list.title
      const Librarylistname:string ="Documents"
      
      compareTwoCommand.visible =(event.selectedRows.length > 0 && Libraryurl == "Documents" )
    }
  }