コード例 #1
0
 def _process(self):
     group = self.group
     provider_title = multipass.identity_providers[
         group.provider].title if not group.is_local else _('Local')
     return WPGroupsAdmin.render_template('group_details.html',
                                          group=group,
                                          provider_title=provider_title)
コード例 #2
0
ファイル: controllers.py プロジェクト: OmeGak/indico
 def _process(self):
     query = LocalGroup.query.options(joinedload(LocalGroup.members)).order_by(db.func.lower(LocalGroup.name))
     groups = [g.proxy for g in query]
     providers = [p for p in multipass.identity_providers.itervalues() if p.supports_groups]
     form = SearchForm(obj=FormDefaults(exact=True))
     if not providers:
         del form.provider
     else:
         form.provider.choices = [("", _("All")), ("indico", _("Local Groups"))] + [
             (p.name, p.title) for p in sorted(providers, key=attrgetter("title"))
         ]
     search_results = None
     if form.validate_on_submit():
         search_providers = None if not providers or not form.provider.data else {form.provider.data}
         search_results = GroupProxy.search(form.name.data, exact=form.exact.data, providers=search_providers)
         search_results.sort(key=attrgetter("provider", "name"))
     provider_titles = {p.name: p.title for p in multipass.identity_providers.itervalues()}
     provider_titles[None] = _("Local")
     return WPGroupsAdmin.render_template(
         "groups.html",
         groups=groups,
         providers=providers,
         form=form,
         search_results=search_results,
         provider_titles=provider_titles,
     )
コード例 #3
0
ファイル: controllers.py プロジェクト: vintas/indico
 def _process(self):
     query = LocalGroup.query.options(joinedload(LocalGroup.members)).order_by(db.func.lower(LocalGroup.name))
     groups = [g.proxy for g in query]
     providers = [p for p in multipass.identity_providers.itervalues() if p.supports_groups]
     form = SearchForm(obj=FormDefaults(exact=True))
     groups_enabled = True
     if not providers and not config.LOCAL_GROUPS:
         groups_enabled = False
     elif not providers:
         del form.provider
     else:
         choices = [('', _('All'))]
         if config.LOCAL_GROUPS:
             choices.append(('indico', _('Local Groups')))
         choices += [(p.name, p.title) for p in sorted(providers, key=attrgetter('title'))]
         form.provider.choices = choices
     search_results = None
     if groups_enabled and form.validate_on_submit():
         search_providers = None if not providers or not form.provider.data else {form.provider.data}
         search_results = GroupProxy.search(form.name.data, exact=form.exact.data, providers=search_providers)
         search_results.sort(key=attrgetter('provider', 'name'))
     provider_titles = {p.name: p.title for p in multipass.identity_providers.itervalues()}
     provider_titles[None] = _('Local')
     return WPGroupsAdmin.render_template('groups.html', groups=groups, providers=providers, form=form,
                                          search_results=search_results, provider_titles=provider_titles,
                                          groups_enabled=groups_enabled)
コード例 #4
0
ファイル: controllers.py プロジェクト: OmeGak/indico
 def _process(self):
     existing_group = self.group if not self.new_group else None
     form = EditGroupForm(obj=existing_group, group=existing_group)
     if form.validate_on_submit():
         form.populate_obj(self.group)
         if self.new_group:
             db.session.add(self.group)
             msg = _("The group '{name}' has been created.")
         else:
             msg = _("The group '{name}' has been updated.")
         db.session.flush()
         flash(msg.format(name=self.group.name), "success")
         return redirect(url_for(".groups"))
     return WPGroupsAdmin.render_template("group_edit.html", group=existing_group, form=form)
コード例 #5
0
 def _process(self):
     existing_group = self.group if not self.new_group else None
     form = EditGroupForm(obj=existing_group, group=existing_group)
     if form.validate_on_submit():
         form.populate_obj(self.group)
         if self.new_group:
             db.session.add(self.group)
             msg = _("The group '{name}' has been created.")
         else:
             msg = _("The group '{name}' has been updated.")
         db.session.flush()
         flash(msg.format(name=self.group.name), 'success')
         return redirect(url_for('.groups'))
     return WPGroupsAdmin.render_template('group_edit.html', group=existing_group, form=form)
コード例 #6
0
 def _process(self):
     query = LocalGroup.query.options(joinedload(LocalGroup.members)).order_by(db.func.lower(LocalGroup.name))
     groups = [GroupProxy(g.id, _group=g) for g in query]
     providers = [p for p in multipass.identity_providers.itervalues() if p.supports_groups]
     form = SearchForm(obj=FormDefaults(exact=True))
     if not providers:
         del form.provider
     else:
         form.provider.choices = ([('', _('All')), ('indico', _('Local Groups'))] +
                                  [(p.name, p.title) for p in sorted(providers, key=attrgetter('title'))])
     search_results = None
     if form.validate_on_submit():
         search_providers = None if not providers or not form.provider.data else {form.provider.data}
         search_results = GroupProxy.search(form.name.data, exact=form.exact.data, providers=search_providers)
         search_results.sort(key=attrgetter('provider', 'name'))
     provider_titles = {p.name: p.title for p in multipass.auth_providers.itervalues()}
     provider_titles[None] = _('Local')
     return WPGroupsAdmin.render_template('groups.html', groups=groups, providers=providers, form=form,
                                          search_results=search_results, provider_titles=provider_titles)
コード例 #7
0
ファイル: controllers.py プロジェクト: OmeGak/indico
 def _process(self):
     group = self.group
     provider_title = multipass.identity_providers[group.provider].title if not group.is_local else _("Local")
     return WPGroupsAdmin.render_template("group_details.html", group=group, provider_title=provider_title)
コード例 #8
0
ファイル: controllers.py プロジェクト: marcosmolla/indico
 def _process(self):
     group = self.group
     provider_title = multipass.auth_providers[group.provider].title if not group.is_local else _('Local')
     return WPGroupsAdmin.render_template('group_details.html', group=group, provider_title=provider_title)