Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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')
Exemplo n.º 16
0
Arquivo: page.py Projeto: 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)
Exemplo n.º 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)))
Exemplo n.º 18
0
Arquivo: tag.py Projeto: 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)))
Exemplo n.º 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)
Exemplo n.º 24
0
Arquivo: tag.py Projeto: 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)
Exemplo n.º 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())
Exemplo n.º 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())
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 29
0
def index():
    return has('tag.show')
Exemplo n.º 30
0
def create_on(check, topic):
    if has('instance.admin'):
        return
    check.other('topic_instance_frozen', topic.instance.frozen)
    create(check)
Exemplo n.º 31
0
def show(t):
    return has('tag.show')
Exemplo n.º 32
0
def show(c):
    return has('comment.view') and not c.is_deleted()
Exemplo n.º 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)
Exemplo n.º 34
0
def delete(i):
    if g.single_instance:
        return False
    return has('global.admin') and show(i)
Exemplo n.º 35
0
def edit(i):
    return has('instance.admin') and show(i)
Exemplo n.º 36
0
def create():
    if g.single_instance:
        return False
    return has('instance.create')
Exemplo n.º 37
0
def show(i):
    return has('instance.show') and not i.is_deleted()
Exemplo n.º 38
0
def any_admin(check):
    check.readonly()
    if has('global.admin'):
        return
    check.perm('instance.admin')
Exemplo n.º 39
0
def index():
    return has('comment.view')
Exemplo n.º 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
Exemplo n.º 41
0
def edit(t):
    return has('tag.edit') and show(t)
Exemplo n.º 42
0
def index():
    if g.single_instance:
        return False
    return has('instance.index')
Exemplo n.º 43
0
def any_admin(check):
    check.readonly()
    if has('global.admin'):
        return
    check.perm('instance.admin')
Exemplo n.º 44
0
def create(check, instance):

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