def set_permissions(username, permissions, uid=None):
 privileges = {'login': '0x0000001', 'drac': '0x0000002', 'user_management': '0x0000004', 'clear_logs': '0x0000008', 'server_control_commands': '0x0000010', 'console_redirection': '0x0000020', 'virtual_media': '0x0000040', 'test_alerts': '0x0000080', 'debug_commands': '0x0000100'}
 permission = 0
 if (uid is None):
  user = list_users()
  uid = user[username]['index']
 for i in permissions.split(','):
  perm = i.strip()
  if (perm in privileges):
   permission += int(privileges[perm], 16)
 return __execute_cmd('config -g cfgUserAdmin -o             cfgUserAdminPrivilege -i {0} 0x{1:08X}'.format(uid, permission))

def set_permissions ( username , permissions , uid = None ) : privileges = { 'login' : '0x0000001' , 'drac' : '0x0000002' , 'user_management' : '0x0000004' , 'clear_logs' : '0x0000008' , 'server_control_commands' : '0x0000010' , 'console_redirection' : '0x0000020' , 'virtual_media' : '0x0000040' , 'test_alerts' : '0x0000080' , 'debug_commands' : '0x0000100' } permission = 0 if ( uid is None ) : user = list_users ( ) uid = user [ username ] [ 'index' ] for i in permissions . split ( ',' ) : perm = i . strip ( ) if ( perm in privileges ) : permission += int ( privileges [ perm ] , 16 ) return __execute_cmd ( 'config -g cfgUserAdmin -o             cfgUserAdminPrivilege -i {0} 0x{1:08X}' . format ( uid , permission ) )
give folder tree and its files their proper permissions .