コード例 #1
0
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()
コード例 #2
0
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()
コード例 #3
0
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()
コード例 #4
0
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()
コード例 #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()
コード例 #6
0
def can_create(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()
    dan = load_dan(g.school)
    return user_is_dan(user, dan) or user.is_admin()
コード例 #7
0
def can_create(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()
	dan = load_dan(g.school)
	return user_is_dan(user, dan) or user.is_admin()
コード例 #8
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()