当前位置: 首页>>代码示例>>Python>>正文


Python security.has_permissions函数代码示例

本文整理汇总了Python中nagare.security.has_permissions函数的典型用法代码示例。如果您正苦于以下问题:Python has_permissions函数的具体用法?Python has_permissions怎么用?Python has_permissions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了has_permissions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: render_BoardDescription

def render_BoardDescription(self, h, comp, *args):
    """Render description component in edit mode"""
    text = var.Var(self.text)
    with h.form(class_='description-form'):
        txt_id, btn_id = h.generate_id(), h.generate_id()
        h << h.label(_(u'Description'), for_=txt_id)
        ta = h.textarea(text(), id_=txt_id).action(text)
        if not security.has_permissions('edit', self):
            ta(disabled='disabled')
        h << ta
        with h.div:
            if security.has_permissions('edit', self):
                h << h.button(_('Save'), class_='btn btn-primary btn-small',
                              id=btn_id).action(remote.Action(lambda: self.change_text(text())))
                h << ' '
                h << h.button(
                    _('Cancel'), class_='btn btn-small').action(remote.Action(lambda: self.change_text(None)))

        h.head.javascript(
            h.generate_id(),
            'YAHOO.kansha.app.addCtrlEnterHandler(%s, %s)' % (
                ajax.py2js(txt_id), ajax.py2js(btn_id)
            )
        )

    return h.root
开发者ID:droodle,项目名称:kansha,代码行数:26,代码来源:view.py

示例2: render_Board

def render_Board(self, h, comp, *args):
    """Main board renderer"""
    security.check_permissions('view', self)
    h.head.css_url('css/themes/board.css')
    h.head.css_url('css/themes/%s/board.css' % self.theme)

    h.head.javascript_url('js/jquery-searchinput/jquery.searchinput.js')
    h.head.javascript_url('js/debounce.js')
    h.head.css_url('js/jquery-searchinput/styles/jquery.searchinput.min.css')
    h.head.javascript('searchinput', '''jQuery(document).ready(function ($) { $('#search').searchInput(); });''')
    title = '%s - %s' % (self.get_title(), self.app_title)
    h.head << h.head.title(title)
    if security.has_permissions('edit', self):
        h << comp.render(h, "menu")

    h << self.modal

    with h.div(class_='board'):
        if self.background_image_url:
            h << {'class': 'board ' + self.background_image_position,
                  'style': 'background-image:url(%s)' % self.background_image_url}
        with h.div(class_='header'):
            with h.div(class_='board-title', style='color: %s' % self.title_color):
                h << self.title.render(h.AsyncRenderer(), 0 if security.has_permissions('edit', self) else 'readonly')
            h << comp.render(h, 'switch')
        with h.div(class_='bbody'):
            h << comp.render(h.AsyncRenderer(), self.model)
    return h.root
开发者ID:nagareproject,项目名称:kansha,代码行数:28,代码来源:view.py

示例3: load_user_boards

    def load_user_boards(self, user=None):
        if user is None:
            user = security.get_user()
        self.my_boards.clear()
        self.guest_boards.clear()
        self.archived_boards.clear()
        last_modifications = {}
        for board_id, in Board.get_all_board_ids(): # Comma is important
            board_obj = self._services(Board, board_id, self.app_title, self.app_banner, self.theme,
                                       self.card_extensions, self.search_engine,
                                       load_children=False)
            if security.has_permissions('manage', board_obj) or security.has_permissions('edit', board_obj):
                board_comp = component.Component(board_obj)
                if board_obj.archived:
                    self.archived_boards[board_id] = board_comp
                else:
                    last_activity = board_obj.get_last_activity()
                    if last_activity is not None:
                        last_modifications[board_id] = (last_activity, board_comp)
                    if security.has_permissions('manage', board_obj):
                        self.my_boards[board_id] = board_comp
                    elif security.has_permissions('edit', board_obj):
                        self.guest_boards[board_id] = board_comp

        last_5 = sorted(last_modifications.values(), reverse=True)[:5]
        self.last_modified_boards = OrderedDict((comp().id, comp) for _modified, comp in last_5)
        public, private = Board.get_templates_for(user.username, user.source)
        self.templates = {'public': [(b.id, b.template_title) for b in public],
                         'private': [(b.id, b.template_title) for b in private]}
开发者ID:daamien,项目名称:kansha,代码行数:29,代码来源:boardsmanager.py

示例4: render_idea_wf_comment_table_row

def render_idea_wf_comment_table_row(self, h, comp, *args):
    with h.td(class_='date'):
        h << format_datetime(self.data.submission_date, format='short')

    with h.td(class_='change'):
        h << _(self.data.from_state.label)
        h << h.div(u" ⬇ ")
        h << _(self.data.to_state.label)

    with h.td(class_='author'):
        # FIXME: we should use a specific "di" view to render the author name
        author = self.data.created_by
        di = self.data.idea_wf.assignated_di
        if author is not di or security.has_permissions('view_di', self):
            h << author.fullname
        else:
            h << _(u'Expert')

    with h.td(class_='comment'):
        if security.has_permissions('edit_comment', self):
            h << self.content_editor.render(h.AsyncRenderer())
        else:
            h << self.data.content

    return h.root
开发者ID:droodle,项目名称:eureka-opensource,代码行数:25,代码来源:workflow.py

示例5: render_Board_item

def render_Board_item(self, h, comp, *args):
    def answer():
        comp.answer(self.data.id)

    url = self.data.url
    with h.li:
        h << h.SyncRenderer().a(
            h.i(' ', class_=VISIBILITY_ICONS[self.data.visibility]),
            self.data.title,
            href=url, class_="boardItemLabel", title=self.data.description)

        with h.div(class_='actions'):
            h << self.comp_members.render(h, 'members')

            if security.has_permissions('manage', self):
                h << h.a(
                    h.i(class_='ico-btn icon-box-add'),
                    class_='archive',
                    title=_(u'Archive "%s"') % self.data.title
                ).action(self.archive, comp)
            elif security.has_permissions('leave', self):
                onclick = 'return confirm("%s")' % _("You won't be able to access this board anymore. Are you sure you want to leave it anyway?")
                h << h.SyncRenderer().a(
                    h.i(class_='ico-btn icon-exit'),
                    class_='leave',
                    title=_(u'Leave "%s"') % self.data.title,
                    onclick=onclick
                ).action(self.leave, comp)
            else:
                # place holder for alignment and for future feature 'request membership'
                h << h.a(h.i(class_='ico-btn icon-user-check'), style='visibility:hidden')
    return h.root
开发者ID:Net-ng,项目名称:kansha,代码行数:32,代码来源:view.py

示例6: render_comment_actions

def render_comment_actions(self, h, comp, *args):

    # delete
    if security.has_permissions('delete_comment', self) and not self.show_delete_form():
        h << h.a(h.i(class_='icon-close'),
                 class_="delete",
                 title=_(u'Delete this comment')).action(lambda: self.show_delete_form(True))

    # moderation
    if not self.comment.moderated and security.has_permissions('moderate_comment', self):
        h << h.a(h.i(class_='icon-remark'),
                 class_="moderate",
                 title=_(u'Moderate this comment')).action(self.moderate)

    if self.comment.moderated and security.has_permissions('unmoderate_comment', self):
        h << h.a(h.i(class_='icon-remark'),
                 class_="unmoderate",
                 title=_(u'Cancel moderation')).action(self.cancel_moderation)

    # vote
    if security.has_permissions('vote_comment', self):
        if self.has_vote():
            label = _(u"I don't find this comment relevant anymore")
            h << h.a(h.i(class_='icon-thumb-down'),
                     title=label).action(self.remove_vote)
        else:
            label = _(u"I find this comment relevant")
            h << h.a(h.i(class_='icon-thumb-up'),
                     title=label).action(self.add_vote)

    return h.root
开发者ID:droodle,项目名称:eureka-opensource,代码行数:31,代码来源:comment.py

示例7: show_frontdesk

 def show_frontdesk(self):
     if security.has_permissions('show_administration_menu', self):
         self.show_administration_menu()
     elif security.has_permissions('show_di_basket', self):
         self.show_di_ideas_basket()
     elif security.has_permissions('show_fi_basket', self):
         self.show_fi_ideas_basket()
     else:
         self.show_home()
开发者ID:droodle,项目名称:eureka-opensource,代码行数:9,代码来源:comp.py

示例8: render_Board_menu

def render_Board_menu(self, h, comp, *args):
    with h.div(class_='navbar', id='boardNavbar'):
        with h.div(class_='navActions', id='boardActions'):
            h << h.a(self.icons['preferences']).action(
                lambda: self.popin.call(
                    popin.Popin(
                        component.Component(
                            BoardConfig(self)
                        ),
                        "edit"
                    )
                )
            )

            if security.has_permissions('edit', self):
                h << self.add_list_overlay
                h << self.edit_description_overlay

            h << h.a(self.icons['export']).action(self.export)

            h << h.a(self.icons['history']).action(
                lambda: self.popin.call(
                    popin.Popin(
                        component.Component(
                            notifications.ActionLog(self)
                        ),
                        'history'
                    )
                )
            )

            if security.has_permissions('manage', self):
                h << h.a(
                    self.icons['archive'],
                    onclick=(
                        'return confirm(%s)' %
                        ajax.py2js(
                            _("This board will be archived. Are you sure?")
                        ).decode('UTF-8')
                    )
                ).action(self.archive_board)
            else:
                h << h.a(
                    self.icons['leave'],
                    onclick=(
                        "return confirm(%s)" %
                        ajax.py2js(
                            _("You won't be able to access this board anymore. Are you sure you want to leave it anyway?")
                        ).decode('UTF-8')
                    )
                ).action(self.leave)

        kw = {'onclick': "YAHOO.kansha.app.toggleMenu('boardNavbar')"}
        with h.div(class_="tab collapse", **kw):
            h << h.a('Board', title='Board', id="boardTab")
    return h.root
开发者ID:droodle,项目名称:kansha,代码行数:56,代码来源:view.py

示例9: render_profile_box_header

def render_profile_box_header(self, h, comp, *args):

    user_comp = component.Component(User(self, self.user))
    with h.section(class_='profile'):
        with h.div(class_='user'):
            # user info
            # avatar image
            h << user_comp.render(h, model='avatar_photo')
            h << h.div(self.user.fullname, class_='name')
            h << h.small(self.user.status_level_label, class_='title')

            if security.has_permissions('edit_avatar', self):
                h << component.Component(self.avatar_editor)

        with h.div(class_='user-info'):

            h << h.h1(self.user.fullname)
            l1 = '-'.join([elt for elt in [self.user.corporation_label, self.user.site_label] if elt])
            l2 = '-'.join([elt for elt in [self.user.direction_label, self.user.service_label] if elt])
            l3 = self.user.position
            if l1 or l2 or l3:
                with h.ul:
                    if l1:
                        h << h.li(l1)
                    if l2:
                        h << h.li(l2)
                    if l3:
                        h << h.li(l3)

            h << h.h2(_('Contact'))
            h << h.a(self.user.email, href="mailto:" + self.user.email)
            h << h.br
            h << (self.user.work_phone or '')
            h << h.br
            h << (self.user.mobile_phone or '')
            h << h.br
            h << h.br

            # FI
            user_fi = self.user.fi
            if security.has_permissions('edit_fi', self):
                h << component.Component(self.fi_editor).render(h)
            elif user_fi:
                h << _(u'Facilitator: ')
                h << h.a(user_fi.fullname,
                         href=self.profile_url(user_fi.uid)).action(lambda uid=user_fi.uid: self.view_profile(uid))
            else:
                with h.p:
                    h << h.a(_(u'No facilitator associated'))

        h << comp.render(h, model='tabs')

    return h.root
开发者ID:droodle,项目名称:eureka-opensource,代码行数:53,代码来源:user.py

示例10: _create_tabs

    def _create_tabs(self):
        can_edit = security.has_permissions('edit_user', self)
        can_view_tracked_ideas = security.has_permissions('view_tracked_ideas', self)

        menu_items = (
            ('profile', True),
            ('settings', can_edit),
            ('tracked_ideas', can_view_tracked_ideas),
            ('ideas', True),
            ('points', True),
            # ('rank', True),
        )
        return [name for name, enabled in menu_items if enabled]
开发者ID:droodle,项目名称:eureka-opensource,代码行数:13,代码来源:comp.py

示例11: render_column_header

def render_column_header(self, h, comp, *args):
    with h.div(class_='list-header', id=self.id + '_header'):
        h << h.a(class_='hidden', id=self.id + '_refresh').action(ajax.Update())
        with h.div(class_='list-title'):
            with h.div(class_='title'):
                h << self.title.render(h.AsyncRenderer(), 0 if security.has_permissions('edit', self) and not self.is_archive else 'readonly')
        h << self.card_counter.render(h, 'header')
        with h.div(class_='list-actions with-dropdown'):
            if security.has_permissions('edit', self):
                h << h.a(h.i(class_='icon-dot-menu'),
                         href='#', class_="toggle-dropdown",
                         onclick="YAHOO.kansha.app.toggleMenu(this)") << ' '
                h << comp.render(h, 'dropdown')
    return h.root
开发者ID:bcroq,项目名称:kansha,代码行数:14,代码来源:view.py

示例12: render

def render(self, h, comp, *args):
    """Render the title of the associated object

    Used by column title and card title on popin
    """
    with h.div(class_='title'):
        kw = {}
        if not security.has_permissions('edit', self):
            kw['style'] = 'cursor: default'
        a = h.a(self.text, **kw)
        if security.has_permissions('edit', self):
            a.action(comp.answer)
        h << a
    return h.root
开发者ID:Reigel,项目名称:kansha,代码行数:14,代码来源:view.py

示例13: render_ColumnTitle

def render_ColumnTitle(self, h, comp, *args):
    """Render the title of the associated object

    Used by column title and card title on popin
    """
    with h.div(class_="title"):
        kw = {}
        if not security.has_permissions("edit", self):
            kw["style"] = "cursor: default"
        a = h.a(self.text, title=self.text, **kw)
        if security.has_permissions("edit", self):
            a.action(comp.answer)
        h << a
    h << h.script("YAHOO.kansha.app.showCardsLimitEdit(%s)" % self.parent.id)
    return h.root
开发者ID:ephilippot,项目名称:kansha,代码行数:15,代码来源:view.py

示例14: has_permission_edit_idea_in_editor

def has_permission_edit_idea_in_editor(self, user, perm, subject):
    idea_comp = subject.idea

    if idea_comp is None:
        return True

    return security.has_permissions('edit_idea', idea_comp)
开发者ID:droodle,项目名称:eureka-opensource,代码行数:7,代码来源:security.py

示例15: render_card_actions

def render_card_actions(self, h, comp, *args):
    with h.div(class_='span2 cardactions'):
        with h.form:
            with h.ul():
                with h.li(class_="buttonAddChecklist"):
                    h << self.checklists.render(h, 'button')
                with h.li(class_="buttonAddFile"):
                    h << self.gallery.render(h, 'download')
                with h.li(class_="buttonVote"):
                    h << self.votes.render(h.AsyncRenderer(), 'edit')
                with h.li(class_="buttonDueDate"):
                    h << self.due_date.render(h.AsyncRenderer(), 'button')
                with h.li(class_="buttonDeleteCard"):
                    if security.has_permissions('edit', self) and not self.column.is_archive:
                        action = h.a.action(lambda: comp.answer('delete')).get('onclick')
                        close_func = 'function (){%s;}' % (action)
                        h << h.button(h.i(class_='icon-remove icon-grey'),
                                      _('Delete'),
                                      class_='btn btn-small',
                                      onclick=("if (confirm(\"%(confirm_msg)s\"))"
                                               " { YAHOO.kansha.app.archiveCard(%(close_func)s, '%(id)s', '%(col_id)s', '%(archive_col_id)s'); }return false;" %
                                               dict(close_func=close_func, id=self.id, col_id=self.column.id,
                                                    archive_col_id=self.column.board.archive_column.id,
                                                    confirm_msg=_(u'This card will be deleted. Are you sure ?'))))
                if self.board.weighting_cards:
                    with h.li(class_="actionWeight"):
                        h << self._weight.on_answer(lambda v: self._weight.call(model='edit_weight' if v else None))
                h << comp.render(h, 'members')

    return h.root
开发者ID:ephilippot,项目名称:kansha,代码行数:30,代码来源:view.py


注:本文中的nagare.security.has_permissions函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。