parameters: (_, username: str, roles: Sequence[str])
docstring: Delete roles from user
docstring_summary: Delete roles from user
docstring_tokens: Delete roles from user
function: def ac_user_del_roles_cmd(_, username: str, roles: Sequence[str]):
      '''
      Delete roles from user
      '''
      rolesname = roles
      roles: List[Role] = []
      for rolename in rolesname:
          try:
              roles.append(mgr.ACCESS_CTRL_DB.get_role(rolename))
          except RoleDoesNotExist as ex:
              if rolename not in SYSTEM_ROLES:
                  return -errno.ENOENT, '', str(ex)
              roles.append(SYSTEM_ROLES[rolename])
      try:
          user = mgr.ACCESS_CTRL_DB.get_user(username)
          user.del_roles(roles)
          mgr.ACCESS_CTRL_DB.save()
          return 0, json.dumps(user.to_dict()), ''
      except UserDoesNotExist as ex:
          return -errno.ENOENT, '', str(ex)
      except RoleNotInUser as ex:
          return -errno.ENOENT, '', str(ex)
function_tokens: def ac_user_del_roles_cmd ( _ , username : str , roles : Sequence [ str ] ) : rolesname = roles roles : List [ Role ] = [ ] for rolename in rolesname : try : roles . append ( mgr . ACCESS_CTRL_DB . get_role ( rolename ) ) except RoleDoesNotExist as ex : if rolename not in SYSTEM_ROLES : return - errno . ENOENT , '' , str ( ex ) roles . append ( SYSTEM_ROLES [ rolename ] ) try : user = mgr . ACCESS_CTRL_DB . get_user ( username ) user . del_roles ( roles ) mgr . ACCESS_CTRL_DB . save ( ) return 0 , json . dumps ( user . to_dict ( ) ) , '' except UserDoesNotExist as ex : return - errno . ENOENT , '' , str ( ex ) except RoleNotInUser as ex : return - errno . ENOENT , '' , str ( ex )