PermissionImport

new PermissionImport()

Permission Import Controller

Handles permission policy import workflow with preview modal showing what policies will be added and removed during the sync operation.

Features:

  • File upload handling for JSON import files
  • Preview analysis showing additions and removals
  • Confirmation modal before applying changes
  • Progress feedback during import

Extends

  • Controller

Members

boundHandleFileSelect :function|null

Bound handleFileSelect reference for cleanup

Type:
  • function | null

boundTriggerFileSelect :function|null

Bound triggerFileSelect reference for cleanup

Type:
  • function | null

externalFileInput :HTMLInputElement|null

External file input reference

Type:
  • HTMLInputElement | null

externalImportButton :HTMLElement|null

External import button reference

Type:
  • HTMLElement | null

importData :string|null

Base64 encoded import data for final submission

Type:
  • string | null

Methods

cancelImport()

Cancel import operation Closes modal and resets state

(async) confirmImport()

Confirm and execute the import Sends the import data to the server for processing

connect()

Initialize controller

disconnect()

Clean up on disconnect

displayPreview(changes)

Display preview information in modal

Parameters:
NameTypeDescription
changesObject

The changes object from preview response

escapeHtml(text) → {string}

Escape HTML to prevent XSS

Parameters:
NameTypeDescription
textstring

Text to escape

Returns:

Escaped text

Type: 
string

formatPolicyName(policyClass) → {string}

Format policy class name for display Extracts just the class name from full namespace

Parameters:
NameTypeDescription
policyClassstring

Full policy class name

Returns:

Formatted class name

Type: 
string

getFileInput() → {HTMLInputElement|null}

Get the file input element (either external or target)

Returns:
Type: 
HTMLInputElement | null

handleFileSelect(event)

Handle file selection Validates file type and initiates preview request

Parameters:
NameTypeDescription
eventEvent

Change event from file input

hideLoadingOverlay()

Hide loading overlay

hideModal()

Hide the preview modal

(async) previewImport(file)

Send file to server for preview analysis

Parameters:
NameTypeDescription
fileFile

The uploaded JSON file

resetFileInput()

Reset the file input value

resetModalContent()

Reset modal content for next use

showLoadingOverlay()

Show loading overlay during processing

showModal()

Show the preview modal

triggerFileSelect()

Trigger file input click Called when the import button is clicked