示例#1
0
def propose():
    if has('instance.admin') and c.instance.use_norms:
        return True
    if not c.instance.allow_propose:
        return False
    if c.instance.frozen:
        return False
    return has('page.edit')
示例#2
0
def propose():
    if has('instance.admin') and c.instance.use_norms:
        return True
    if not c.instance.allow_propose:
        return False
    if c.instance.frozen:
        return False
    return has('page.edit')
示例#3
0
def delete(co):
    if has('instance.admin'):
        return True
    if co.topic.instance.frozen:
        return False
    if edit(co) and is_own(co) and not co.is_edited():
        return True
    return has('comment.delete') and show(co) and not \
        (not co.topic.is_mutable() and co.canonical)
示例#4
0
def create(p):
    if not p.is_mutable():
        return False
    if has('instance.admin'):
        return True
    if not (has('proposal.edit') and show(p)):
        return False
    #if (p.description.head.wiki or is_own(p)):
    #    return True
    return True
示例#5
0
def create(p):
    if not p.is_mutable():
        return False
    if has('instance.admin'):
        return True
    if not (has('proposal.edit') and show(p)):
        return False
    #if (p.description.head.wiki or is_own(p)):
    #    return True
    return True
示例#6
0
def edit(co):
    if not co.is_mutable():
        return False
    if has('instance.admin'):
        return True
    if co.topic.instance.frozen:
        return False
    if not (has('comment.edit') and show(co)):
        return False
    if not (co.wiki or is_own(co)):
        return False
    return True
示例#7
0
def edit(check, p, variant):
    check.valid_email()
    check.other('instance_without_norms', not p.instance.use_norms)
    check.other('instance_frozen', p.instance.frozen)
    check.other('variant_is_none', variant is None)
    if has('instance.admin'):
        return
    page.edit(check, p)

    check.other('page_has_no_variants_and_variant_is_not_head',
                not p.has_variants and variant != Text.HEAD)

    if not has('page.edit_head'):
        check.other('page_function_is_norm_and_variant_is_head',
                    p.function == p.NORM and variant == Text.HEAD)
示例#8
0
文件: instance.py 项目: alkadis/vcv
def message(check, i):
    check.readonly()

    if has('global.message'):
        return
    check.other('is_not_authenticated', not i.is_authenticated)
    check.perm('instance.message')
示例#9
0
文件: instance.py 项目: alkadis/vcv
def message(check, i):
    check.readonly()

    if has('global.message'):
        return
    check.other('is_not_authenticated', not i.is_authenticated)
    check.perm('instance.message')
示例#10
0
def leave(i):
    if g.single_instance:
        return False
    if i.frozen:
        return False
    return show(i) and has('instance.leave') and c.user and \
        c.user.is_member(i) and not c.user == i.creator
示例#11
0
文件: selection.py 项目: whausen/part
def create(check, p):
    check.valid_email()
    check.other('proposal_not_mutable', not p.is_mutable())
    if has('instance.admin'):
        return
    check.perm('proposal.edit')
    show(check, p)
示例#12
0
def leave(i):
    if g.single_instance:
        return False
    if i.frozen:
        return False
    return show(i) and has('instance.leave') and c.user and \
        c.user.is_member(i) and not c.user == i.creator
示例#13
0
def delete(check, t):
    if has('instance.admin'):
        return
    check.perm('tag.delete')
    show(check, t)
    check.other('not_logged_in', not c.user)
    check.other('tag_creator_is_not_user', t.creator != c.user)
示例#14
0
def delete(check, p, variant):
    check.valid_email()
    check.other('variant_is_none', variant is None)
    check.other('variant_is_head', variant == Text.HEAD)
    if has('instance.admin'):
        return
    page.delete(check, p)
示例#15
0
def propose(check):
    check.other('instance_without_norms', not c.instance.use_norms)
    if has('instance.admin'):
        return
    check.other('no_instance_allow_propose', not c.instance.allow_propose)
    check.other('instance_frozen', c.instance.frozen)
    check.perm('page.edit')
示例#16
0
文件: page.py 项目: whausen/part
def edit(check, p):
    check.valid_email()
    check.other('page_not_mutable', not p.is_mutable())
    if has('instance.admin'):
        return
    check.perm('page.edit')
    show(check, p)
示例#17
0
def edit(check, co):
    check.other('comment_not_mutable', not co.is_mutable())
    if has('instance.admin'):
        return
    check.other('comment_topic_instance_frozen', co.topic.instance.frozen)
    check.perm('comment.edit')
    show(check, co)
    check.other('comment_is_not_wiki_or_own', not (co.wiki or is_own(co)))
示例#18
0
文件: tag.py 项目: whausen/part
def delete(check, t):
    check.valid_email()
    if has('instance.admin'):
        return
    check.perm('tag.delete')
    show(check, t)
    check.other(NOT_LOGGED_IN, not c.user)
    check.other('tag_creator_is_not_user', t.creator != c.user)
示例#19
0
文件: selection.py 项目: alkadis/vcv
def create(check, p):
    check.readonly()
    check.valid_email()
    check.other('proposal_not_mutable', not p.is_mutable())
    if has('instance.admin'):
        return
    check.perm('proposal.edit')
    show(check, p)
示例#20
0
def delete(p, variant):
    if variant is None:
        return False
    if variant == Text.HEAD:
        return False
    if has("instance.admin"):
        return True
    return page.delete(p)
示例#21
0
def delete(p, variant):
    if variant is None:
        return False
    if variant == Text.HEAD:
        return False
    if has('instance.admin'):
        return True
    return page.delete(p)
示例#22
0
def edit(check, co):
    check.other('comment_not_mutable', not co.is_mutable())
    if has('instance.admin'):
        return
    check.other('comment_topic_instance_frozen', co.topic.instance.frozen)
    check.perm('comment.edit')
    show(check, co)
    check.other('comment_is_not_wiki_or_own', not (co.wiki or is_own(co)))
示例#23
0
文件: comment.py 项目: alkadis/vcv
def create_on(check, topic):
    check.readonly()
    check.valid_email()
    if has('instance.admin'):
        return
    check.other('comment_topic_frozen', topic.is_frozen())
    check.other('comment_topic_instance_frozen', topic.instance.frozen)
    create(check)
示例#24
0
文件: tag.py 项目: alkadis/vcv
def delete(check, t):
    check.readonly()
    check.valid_email()
    if has("instance.admin"):
        return
    check.perm("tag.delete")
    show(check, t)
    check.other(NOT_LOGGED_IN, not c.user)
    check.other("tag_creator_is_not_user", t.creator != c.user)
示例#25
0
def delete(check, co):
    if has('instance.admin'):
        return
    check.other('comment_topic_instance_frozen', co.topic.instance.frozen)
    edit(check, co)
    check.other('comment_is_not_own', not is_own(co))
    check.other('comment_is_edited', co.is_edited())
    check.perm('comment.delete')
    show(check, co)
    check.other('comment_not_mutable', not co.topic.is_mutable())
示例#26
0
def delete(check, co):
    if has('instance.admin'):
        return
    check.other('comment_topic_instance_frozen', co.topic.instance.frozen)
    edit(check, co)
    check.other('comment_is_not_own', not is_own(co))
    check.other('comment_is_edited', co.is_edited())
    check.perm('comment.delete')
    show(check, co)
    check.other('comment_not_mutable', not co.topic.is_mutable())
示例#27
0
def edit(p, variant):
    if not p.instance.use_norms:
        return False
    if p.instance.frozen:
        return False
    if variant is None:
        return False
    if has("instance.admin"):
        return True
    if not page.edit(p):
        return False
    if not p.has_variants and variant != Text.HEAD:
        return False
    if p.function == p.NORM and variant == Text.HEAD:
        return False
    return True
示例#28
0
def edit(p, variant):
    if not p.instance.use_norms:
        return False
    if p.instance.frozen:
        return False
    if variant is None:
        return False
    if has('instance.admin'):
        return True
    if not page.edit(p):
        return False
    if not p.has_variants and variant != Text.HEAD:
        return False
    if p.function == p.NORM and variant == Text.HEAD:
        return False
    return True
示例#29
0
def index():
    return has('tag.show')
示例#30
0
def create_on(check, topic):
    if has('instance.admin'):
        return
    check.other('topic_instance_frozen', topic.instance.frozen)
    create(check)
示例#31
0
def show(t):
    return has('tag.show')
示例#32
0
def show(c):
    return has('comment.view') and not c.is_deleted()
示例#33
0
def join(i):
    if i.frozen:
        return False
    return show(i) and has('instance.join') and c.user and \
        not c.user.is_member(i)
示例#34
0
def delete(i):
    if g.single_instance:
        return False
    return has('global.admin') and show(i)
示例#35
0
def edit(i):
    return has('instance.admin') and show(i)
示例#36
0
def create():
    if g.single_instance:
        return False
    return has('instance.create')
示例#37
0
def show(i):
    return has('instance.show') and not i.is_deleted()
示例#38
0
def any_admin(check):
    check.readonly()
    if has('global.admin'):
        return
    check.perm('instance.admin')
示例#39
0
def index():
    return has('comment.view')
示例#40
0
def delete(t):
    if has('instance.admin'):
        return True
    return has('tag.delete') and show(t) and c.user and t.creator == c.user
示例#41
0
def edit(t):
    return has('tag.edit') and show(t)
示例#42
0
def index():
    if g.single_instance:
        return False
    return has('instance.index')
示例#43
0
文件: instance.py 项目: alkadis/vcv
def any_admin(check):
    check.readonly()
    if has('global.admin'):
        return
    check.perm('instance.admin')
示例#44
0
文件: message.py 项目: whausen/part
def create(check, instance):

    if has('global.message'):
        return
    check.other('is_not_authenticated', not instance.is_authenticated)
    check.perm('instance.message')
示例#45
0
def create_on(topic):
    if has('instance.admin'):
        return True
    if topic.instance.frozen:
        return False
    return create()
示例#46
0
def create():
    return has('comment.create')