'Check whether the user can manage the folder.
:returns:   the original folder
:rtype:     LibraryFolder
:raises: AuthenticationRequired, InsufficientPermissionsException'

def check_manageable(self, trans, folder):

    if (not trans.user):
        raise AuthenticationRequired('Must    be    logged    in    to    manage    Galaxy    items.', type='error')
    current_user_roles = trans.get_current_user_roles()
    if (not trans.app.security_agent.can_manage_library_item(current_user_roles, folder)):
        raise InsufficientPermissionsException("You    don't    have    permissions    to    manage    this    folder.", type='error')
    else:
        return folder
