def can_edit_proposal(proposal, user=None):
	""" Can a user edit a particular proposal?
	Allow the proposal author, the school committee members, and admins """
	user = user or current_user._get_current_object()
	dans = [load_dan(school) for school in proposal.schools]
	if user.is_anonymous():
		return False
	return user_is_a_dan(user, dans) or proposal.proposer==user or user.is_admin()
def can_organize_proposal(proposal, user=None):
    """ Can a user organize a proposal (adding events to it)?
	Allow the school committee and admins """
    user = user or current_user._get_current_object()
    dans = [load_dan(school) for school in proposal.schools]
    if user.is_anonymous():
        return False
    print user.is_admin()
    return user_is_a_dan(user, dans) or user.is_admin()
def can_edit_proposal(proposal, user=None):
    """ Can a user edit a particular proposal?
	Allow the proposal author, the school committee members, and admins """
    user = user or current_user._get_current_object()
    dans = [load_dan(school) for school in proposal.schools]
    if user.is_anonymous():
        return False
    return user_is_a_dan(user,
                         dans) or proposal.proposer == user or user.is_admin()
def can_organize_proposal(proposal, user=None):
	""" Can a user organize a proposal (adding events to it)?
	Allow the school committee and admins """
	user = user or current_user._get_current_object()
	dans = [load_dan(school) for school in proposal.schools]
	if user.is_anonymous():
		return False
	print user.is_admin()
	return user_is_a_dan(user, dans) or user.is_admin()
Beispiel #5
0
def can_edit(obj, user=None):
    """ Can a user organize a proposal (adding events to it)?
	Allow the school committee and admins """
    user = user or current_user._get_current_object()
    dans = [load_dan(school) for school in obj.schools]
    return user_is_a_dan(user, dans) or obj.creator == user or user.is_admin()
def can_edit(obj, user=None):
	""" Can a user organize a proposal (adding events to it)?
	Allow the school committee and admins """
	user = user or current_user._get_current_object()
	dans = [load_dan(school) for school in obj.schools]
	return user_is_a_dan(user, dans) or obj.creator==user or user.is_admin()