@@ -1406,19 +1406,20 @@ def verify_required(self, record): # type: (vault.TypedRecord) -> None
1406
1406
1407
1407
1408
1408
class PAMConfigurationNewCommand (Command , PamConfigurationEditMixin ):
1409
+ choices = ['on' , 'off' , 'default' ]
1409
1410
parser = argparse .ArgumentParser (prog = 'pam config new' , parents = [common_parser ])
1410
- parser .add_argument ('--enable- connections' , '-ec ' , dest = 'enable_connections ' , action = 'store_true' ,
1411
- help = 'Enable connections' )
1412
- parser .add_argument ('--enable- tunneling' , '-et ' , dest = 'enable_tunneling' ,
1413
- action = 'store_true' , help = 'Enable tunneling' )
1414
- parser .add_argument ('--enable- rotation' , '-er ' , dest = 'enable_rotation ' , action = 'store_true' ,
1415
- help = 'Enable rotation' )
1416
- parser .add_argument ('--enable- remote-browser-isolation' , '-erbi ' , dest = 'enable_remotebrowserisolation' ,
1417
- action = 'store_true' , help = 'Enable remote browser isolation' )
1418
- parser .add_argument ('--enable- connections-recording' , '-ecr ' , required = False , dest = 'recordingenabled' ,
1419
- action = 'store_true' , help = 'Enable recording connections for the resource' )
1420
- parser .add_argument ('--enable-typescripts- recording' , '-etcr ' , required = False , dest = 'typescriptrecordingenabled' ,
1421
- action = 'store_true' , help = 'Enable TypeScript recording for the resource' )
1411
+ parser .add_argument ('--connections' , '-c ' , dest = 'connections ' , choices = choices ,
1412
+ help = 'Set connections permissions ' )
1413
+ parser .add_argument ('--tunneling' , '-u ' , dest = 'tunneling' , choices = choices ,
1414
+ help = 'Set tunneling permissions ' )
1415
+ parser .add_argument ('--rotation' , '-r ' , dest = 'rotation ' , choices = choices ,
1416
+ help = 'Set rotation permissions ' )
1417
+ parser .add_argument ('--remote-browser-isolation' , '-rbi ' , dest = 'remotebrowserisolation' , choices = choices ,
1418
+ help = 'Set remote browser isolation permissions ' )
1419
+ parser .add_argument ('--connections-recording' , '-cr ' , dest = 'recording' , choices = choices ,
1420
+ help = 'Set recording connections permissions for the resource' )
1421
+ parser .add_argument ('--typescript- recording' , '-tr ' , dest = 'typescriptrecording' , choices = choices ,
1422
+ help = 'Set TypeScript recording permissions for the resource' )
1422
1423
1423
1424
def __init__ (self ):
1424
1425
super ().__init__ ()
@@ -1479,12 +1480,12 @@ def execute(self, params, **kwargs):
1479
1480
tmp_dag = TunnelDAG (params , encrypted_session_token , encrypted_transmission_key , record_uid = record .record_uid ,
1480
1481
is_config = True )
1481
1482
tmp_dag .edit_tunneling_config (
1482
- bool ( kwargs .get ('enable_connections' ) ),
1483
- bool ( kwargs .get ('enable_tunneling' ) ),
1484
- bool ( kwargs .get ('enable_rotation' ) ),
1485
- bool ( kwargs .get ('recordingenabled' ) ),
1486
- bool ( kwargs .get ('typescriptrecordingenabled' ) ),
1487
- bool ( kwargs .get ('enable_remotebrowserisolation' ) )
1483
+ kwargs .get ('connections' ),
1484
+ kwargs .get ('tunneling' ),
1485
+ kwargs .get ('rotation' ),
1486
+ kwargs .get ('recording' ),
1487
+ kwargs .get ('typescriptrecording' ),
1488
+ kwargs .get ('remotebrowserisolation' )
1488
1489
)
1489
1490
tmp_dag .print_tunneling_config (record .record_uid , None )
1490
1491
@@ -1509,32 +1510,23 @@ def execute(self, params, **kwargs):
1509
1510
1510
1511
1511
1512
class PAMConfigurationEditCommand (Command , PamConfigurationEditMixin ):
1513
+ choices = ['on' , 'off' , 'default' ]
1512
1514
parser = argparse .ArgumentParser (prog = 'pam config edit' , parents = [common_parser ])
1513
1515
parser .add_argument ('uid' , type = str , action = 'store' , help = 'The Config UID to edit' )
1514
1516
parser .add_argument ('--remove-resource-record' , '-rrr' , dest = 'remove_records' , action = 'append' ,
1515
1517
help = 'Resource Record UID to remove' )
1516
- parser .add_argument ('--enable-rotation' , '-er' , required = False , action = 'store_true' ,help = 'Enable rotation' )
1517
- parser .add_argument ('--disable-rotation' , '-dr' , required = False , action = 'store_true' , help = 'Disable rotation' )
1518
- parser .add_argument ('--enable-tunneling' , '-et' , required = False , dest = 'enable_tunneling' , action = 'store_true' ,
1519
- help = 'Disable tunneling' )
1520
- parser .add_argument ('--disable-tunneling' , '-dt' , required = False , dest = 'disable_tunneling' , action = 'store_true' ,
1521
- help = 'Disable tunneling' )
1522
- parser .add_argument ('--enable-connections' , '-ec' , required = False , dest = 'enable_connections' , action = 'store_true' ,
1523
- help = 'Enable connections' )
1524
- parser .add_argument ('--disable-connections' , '-dc' , required = False , dest = 'disable_connections' , action = 'store_true' ,
1525
- help = 'Enable connections' )
1526
- parser .add_argument ('--enable-remote-browser-isolation' , '-erbi' , required = False , dest = 'enable_remotebrowserisolation' , action = 'store_true' ,
1527
- help = 'Enable remote browser isolation' )
1528
- parser .add_argument ('--disable-remote-browser-isolation' , '-drbi' , required = False , dest = 'disable_remotebrowserisolation' , action = 'store_true' ,
1529
- help = 'Disable remote browser isolation' )
1530
- parser .add_argument ('--enable-connections-recording' , '-ecr' , required = False , dest = 'enable_connections_recording' ,
1531
- action = 'store_true' , help = 'Enable connections recording' )
1532
- parser .add_argument ('--disable-connections-recording' , '-dcr' , required = False , dest = 'disable_connections_recording' ,
1533
- action = 'store_true' , help = 'Disable connections recording' )
1534
- parser .add_argument ('--enable-typescripts-recording' , '-etsr' , required = False , dest = 'enable_typescripts_recording' ,
1535
- action = 'store_true' , help = 'Enable typescripts recording' )
1536
- parser .add_argument ('--disable-typescripts-recording' , '-dtsr' , required = False , dest = 'disable_typescripts_recording' ,
1537
- action = 'store_true' , help = 'Disable typescripts recording' )
1518
+ parser .add_argument ('--connections' , '-c' , dest = 'connections' , choices = choices ,
1519
+ help = 'Set connections permissions' )
1520
+ parser .add_argument ('--tunneling' , '-u' , dest = 'tunneling' , choices = choices ,
1521
+ help = 'Set tunneling permissions' )
1522
+ parser .add_argument ('--rotation' , '-r' , dest = 'rotation' , choices = choices ,
1523
+ help = 'Set rotation permissions' )
1524
+ parser .add_argument ('--remote-browser-isolation' , '-rbi' , dest = 'remotebrowserisolation' , choices = choices ,
1525
+ help = 'Set remote browser isolation permissions' )
1526
+ parser .add_argument ('--connections-recording' , '-cr' , dest = 'recording' , choices = choices ,
1527
+ help = 'Set recording connections permissions for the resource' )
1528
+ parser .add_argument ('--typescript-recording' , '-tr' , dest = 'typescriptrecording' , choices = choices ,
1529
+ help = 'Set TypeScript recording permissions for the resource' )
1538
1530
1539
1531
def __init__ (self ):
1540
1532
super (PAMConfigurationEditCommand , self ).__init__ ()
@@ -1614,30 +1606,16 @@ def execute(self, params, **kwargs):
1614
1606
if shared_folder_uid != orig_shared_folder_uid :
1615
1607
FolderMoveCommand ().execute (params , src = configuration .record_uid , dst = shared_folder_uid )
1616
1608
1617
- if ((kwargs .get ('enable_connections' ) and kwargs .get ('disable_connections' )) or
1618
- (kwargs .get ('enable_tunneling' ) and kwargs .get ('disable_tunneling' )) or
1619
- (kwargs .get ('enable_rotation' ) and kwargs .get ('disable_rotation' )) or
1620
- (kwargs .get ('enable_remotebrowserisolation' ) and kwargs .get ('disable_remotebrowserisolation' )) or
1621
- (kwargs .get ('enable_connections_recording' ) and kwargs .get ('disable_connections_recording' )) or
1622
- (kwargs .get ('enable_typescripts_recording' ) and kwargs .get ('disable_typescripts_recording' ))):
1623
- raise CommandError ('pam-config-edit' , 'Cannot enable and disable the same feature at the same time' )
1624
-
1625
- # First check if enabled is true then check if disabled is true. if not then set it to None
1626
- _connections = True if kwargs .get ('enable_connections' ) \
1627
- else False if kwargs .get ('disable_connections' ) else None
1628
- _tunneling = True if kwargs .get ('enable_tunneling' ) \
1629
- else False if kwargs .get ('disable_tunneling' ) else None
1630
- _rotation = True if kwargs .get ('enable_rotation' ) \
1631
- else False if kwargs .get ('disable_rotation' ) else None
1632
- _rbi = True if kwargs .get ('enable_remotebrowserisolation' ) \
1633
- else False if kwargs .get ('disable_remotebrowserisolation' ) else None
1634
- _recording = True if kwargs .get ('enable_connections_recording' ) \
1635
- else False if kwargs .get ('disable_connections_recording' ) else None
1636
- _typescript_recording = True if kwargs .get ('enable_typescripts_recording' ) \
1637
- else False if kwargs .get ('disable_typescripts_recording' ) else None
1609
+ # check if there are any permission changes
1610
+ _connections = kwargs .get ('connections' , None )
1611
+ _tunneling = kwargs .get ('tunneling' , None )
1612
+ _rotation = kwargs .get ('rotation' , None )
1613
+ _rbi = kwargs .get ('remotebrowserisolation' , None )
1614
+ _recording = kwargs .get ('recording' , None )
1615
+ _typescript_recording = kwargs .get ('typescriptrecording' , None )
1638
1616
1639
1617
if (_connections is not None or _tunneling is not None or _rotation is not None or _rbi is not None or
1640
- _recording is not None or _typescript_recording is not None ):
1618
+ _recording is not None or _typescript_recording is not None ):
1641
1619
encrypted_session_token , encrypted_transmission_key , transmission_key = get_keeper_tokens (params )
1642
1620
tmp_dag = TunnelDAG (params , encrypted_session_token , encrypted_transmission_key ,
1643
1621
configuration .record_uid , is_config = True )
0 commit comments