def is_affiliated():
 if (not auth.is_logged_in()):
  return False
 elif s3_has_role(ADMIN):
  return True
 else:
  table = auth.settings.table_user
  auth_user = db((table.id == auth.user.id)).select(table.organisation_id, limitby=(0, 1)).first()
  if (auth_user and auth_user.organisation_id):
   return True
  else:
   return False

def is_affiliated ( ) : if ( not auth . is_logged_in ( ) ) : return False elif s3_has_role ( ADMIN ) : return True else : table = auth . settings . table_user auth_user = db ( ( table . id == auth . user . id ) ) . select ( table . organisation_id , limitby = ( 0 , 1 ) ) . first ( ) if ( auth_user and auth_user . organisation_id ) : return True else : return False
check if user is affiliated to an organisation @todo: move this elsewhere .