Пример #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
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
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
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
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
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
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
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
def any_admin(check):
    check.readonly()
    if has('global.admin'):
        return
    check.perm('instance.admin')
Пример #44
0
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')