ENLIGHTEN
Cross-platform desktop GUI for Wasatch Photonics spectrometers
Loading...
Searching...
No Matches
enlighten.ui.Authentication.Authentication Class Reference

This class encapsulates the process of "logging-in" to ENLIGHTEN and enabling or displaying GUI widgets which should only be exposed to certain user classes. More...

Public Member Functions

 __init__ (self, ctl)
 
 has_advanced_rights (self)
 
 has_oem_rights (self)
 
 has_production_rights (self)
 
 login (self, switch_to_factory=False, password=None)
 The user has clicked "Advanced Features" or pressed "Ctrl-A," so display the login pop-up, get their password, compare it to supported values and update features accordingly.
 
 register_observer (self, callback)
 

Public Attributes

 button_login = cfu.pushButton_admin_login
 
 combo_view = cfu.comboBox_view
 
 ctl = ctl
 
int error_count = 0
 
int level = self.BASIC
 
 login
 
 observers = set()
 

Static Public Attributes

int ADVANCED = 1
 
int BASIC = 0
 
int OEM = 2
 
int PRODUCTION = 3
 
str PRODUCTION_DIGEST = '830147906ad1e20efe9a12b5d0b5242f'
 

Protected Member Functions

 _update_auth_widget (self, widget, auth)
 If you want a hidden widget to become VISIBLE if the user is logged-in, use the Qt Designer to give the widget a boolean "custom property" called "initiallyVisible" and set it False.
 
 _update_widgets (self)
 

Detailed Description

This class encapsulates the process of "logging-in" to ENLIGHTEN and enabling or displaying GUI widgets which should only be exposed to certain user classes.

Currently there are four levels setup:

  • BASIC
    • default, no authentication required
    • user cannot edit ANY of the fields in the EEPROMEditor (display-only)
    • user can "save .ini", and edit desired fields directly in that file (only affects their PC, in their Documents directory)
    • cannot write EEPROM
  • ADVANCED
    • password "wasatch" (hardcoded)
    • enables "Advanced Users" controls
      • some manufacturing tests and experimental features
      • excitation spinner on Laser Control Widget
    • allows user to edit "safe" fields in the EEPROM editor (see EEPROM.is_editable)
    • editted "safe" fields can be saved to .ini
    • still cannot write EEPROM
  • OEM
    • password "wasatchoem" (hardcoded)
    • displays "Save EEPROM" button
    • EEPROM can be written, but EEPROM.write_eeprom() method will only update "is_editable" fields in the page buffers before writing
  • PRODUCTION
    • password NOT hardcoded (ask Zieg or production team)
    • all EEPROM fields editable
    • EEPROM can be written

You'll note we're not too worried about security, hard-coding passwords and hashes and all. The truth is that our full USB API is (deliberately) published for application developers in ENG-0001, and the full EEPROM layout is defined publicly in ENG-0034, so essentially any knowledgable user can do anything anyway. This is more a matter of keeping dangerous / confusing / experimental options on a high shelf so new users don't randomly click buttons just to see what they do.

Relationship to Advanced Options

They are disconnected and orthogonal (see Advanced Options docs).

Constructor & Destructor Documentation

◆ __init__()

enlighten.ui.Authentication.Authentication.__init__ ( self,
ctl )

Member Function Documentation

◆ _update_auth_widget()

enlighten.ui.Authentication.Authentication._update_auth_widget ( self,
widget,
auth )
protected

If you want a hidden widget to become VISIBLE if the user is logged-in, use the Qt Designer to give the widget a boolean "custom property" called "initiallyVisible" and set it False.

By default, Authentication just determines whether a widget is ENABLED, not VISIBLE (think EEPROMEditor fields). Widgets lacking this custom property will be visible at all times, and only their ENABLED status will change.

(Obviously, in addition to the custom property, you must also add such widgets to the constructor lists passed to this object.)

◆ _update_widgets()

enlighten.ui.Authentication.Authentication._update_widgets ( self)
protected

◆ has_advanced_rights()

enlighten.ui.Authentication.Authentication.has_advanced_rights ( self)

◆ has_oem_rights()

enlighten.ui.Authentication.Authentication.has_oem_rights ( self)

◆ has_production_rights()

enlighten.ui.Authentication.Authentication.has_production_rights ( self)

◆ login()

enlighten.ui.Authentication.Authentication.login ( self,
switch_to_factory = False,
password = None )

The user has clicked "Advanced Features" or pressed "Ctrl-A," so display the login pop-up, get their password, compare it to supported values and update features accordingly.

◆ register_observer()

enlighten.ui.Authentication.Authentication.register_observer ( self,
callback )

Member Data Documentation

◆ ADVANCED

int enlighten.ui.Authentication.Authentication.ADVANCED = 1
static

◆ BASIC

int enlighten.ui.Authentication.Authentication.BASIC = 0
static

◆ button_login

enlighten.ui.Authentication.Authentication.button_login = cfu.pushButton_admin_login

◆ combo_view

enlighten.ui.Authentication.Authentication.combo_view = cfu.comboBox_view

◆ ctl

enlighten.ui.Authentication.Authentication.ctl = ctl

◆ error_count

int enlighten.ui.Authentication.Authentication.error_count = 0

◆ level

int enlighten.ui.Authentication.Authentication.level = self.BASIC

◆ login

enlighten.ui.Authentication.Authentication.login

◆ observers

enlighten.ui.Authentication.Authentication.observers = set()

◆ OEM

int enlighten.ui.Authentication.Authentication.OEM = 2
static

◆ PRODUCTION

int enlighten.ui.Authentication.Authentication.PRODUCTION = 3
static

◆ PRODUCTION_DIGEST

str enlighten.ui.Authentication.Authentication.PRODUCTION_DIGEST = '830147906ad1e20efe9a12b5d0b5242f'
static

The documentation for this class was generated from the following file: