def getOutingButtonsTop(handler):
    """
    Renders and returns the buttons for the top of an outings page.

    handler: the current page handler

    returns: string
    """
    # Determine if the user can add an outing
    loggedInUser = uau.getLoggedInUser(handler)
    canAddOuting = False
    if loggedInUser != None and uau.doesUserHavePermission(loggedInUser.accountLevel, uau.poster):
        canAddOuting = True

    # Get the rendered buttons
    return jtr.getRenderedTemplate(pathToOutingTemplates, buttonsTopTemplateName, { 'can_add_outing': canAddOuting })
def userIsAuthorized(handler, requiredAccountLevel):
    """    
    Determines whether the current user's account level meets the required account level.
    If the user does not, sets the redirect flags to the unauthroized page. Usually, if this
    method returns false the caller will want to immediately return.

    handler: the current page handler
    requiredAccountLevel: the required level

    returns: bool
    """
    currentUser = uau.getLoggedInUser(handler)
    userAccountLevel = uau.loggedOut    
    if currentUser != None:
        userAccountLevel = currentUser.accountLevel

    if not uau.doesUserHavePermission(userAccountLevel, requiredAccountLevel):
        handler.redirect('/unauthorized')
        return False

    return True