puiterwijk / ipsilon

Forked from ipsilon 8 years ago
Clone

a4061dd Convert stored Condition config options back to booleans

2 files Authored by merlinthp 7 years ago, Committed by puiterwijk 7 years ago,
    Convert stored Condition config options back to booleans
    
    All options types are stored as strings in the backend database.  The
    Condition config option type is a subclass of the Pick option that has
    only the Python True and False values as valid values.  When a specific
    value for the option is stored into the database, this is rendered into the
    text strings 'True' or 'False'.  When the option is loaded back from the
    database, it remains a string.  This causes the issue that any "it option"
    style checks will always evaluate to true.  This manifests in the plugin
    configuration pages, where the checkboxes for Condition options are always
    checked, even if the value is set to false in the database.
    
    This patch adds code to the Condition import_value function to coerce the
    strings into Python bools.
    
    The authfas plugin has a Condition option that it tries to use the value of
    as a string, so convert that to a boolean operation.
    
    Signed-off-by: Howard Johnson <merlin@merlinthp.org>
    Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
    
        
file modified
+1 -1
file modified
+7 -3