def login(): # pragma: no cover """ Login mechanism for this application. """ next_url = flask.url_for("ui_ns.index") if "next" in flask.request.values: if is_safe_url(flask.request.values["next"]): next_url = flask.request.values["next"] if next_url == flask.url_for("ui_ns.login"): next_url = flask.url_for("ui_ns.index") if hasattr(flask.g, "fas_user") and flask.g.fas_user is not None: return flask.redirect(next_url) else: groups = pkgdblib.get_groups(SESSION) groups.extend(APP.config["ADMIN_GROUP"]) groups.append("packager") return FAS.login(return_url=next_url, groups=groups)
def login(): # pragma: no cover """ Login mechanism for this application. """ next_url = flask.url_for('ui_ns.index') if 'next' in flask.request.values: if is_safe_url(flask.request.values['next']): next_url = flask.request.values['next'] if next_url == flask.url_for('ui_ns.login'): next_url = flask.url_for('ui_ns.index') if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None: return flask.redirect(next_url) else: groups = pkgdblib.get_groups(SESSION) groups.extend(APP.config['ADMIN_GROUP']) groups.append('packager') return FAS.login(return_url=next_url, groups=groups)
def login(): # pragma: no cover """ Login mechanism for this application. """ next_url = flask.url_for('ui_ns.index') if 'next' in flask.request.values: if is_safe_url(flask.request.values['next']): next_url = flask.request.values['next'] if next_url == flask.url_for('ui_ns.login'): next_url = flask.url_for('ui_ns.index') if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None: return flask.redirect(next_url) else: groups = pkgdblib.get_groups(SESSION) groups.extend(APP.config['ADMIN_GROUP']) groups.append(APP.config.get('PKGER_GROUP', 'packager')) return FAS.login(return_url=next_url, groups=groups)
def api_groups(): ''' List group maintainer --------------------- Return the list FAS groups which have ACLs on one or more packages. :: /api/groups :kwarg format: Specify if the output if text or json. ''' out_format = flask.request.args.get('format', 'text') if out_format not in ('text', 'json'): out_format = 'text' if request_wants_json(): out_format = 'json' output = {} groups = pkgdblib.get_groups(SESSION) if out_format == 'json': output = {"groups": groups} output['total_groups'] = len(groups) return flask.jsonify(output) else: output = [ "# Number of groups: %s" % len(groups)] for entry in sorted(groups): output.append("%s" % (entry)) return flask.Response( '\n'.join(output), content_type="text/plain;charset=UTF-8" )