Beispiel #1
0
	def showAddForm(self, req, reposname, errormsg=''):
		templatevars = {}
		templatevars['errormsg'] = errormsg
		templatevars['repository'] = reposname
		templatevars["systems"] = vcs_list()
		formatted = evaluate_main('newrepository.html', templatevars, request=req)
		return Response(formatted)
Beispiel #2
0
 def showAddForm(self, req, username, email, fullname, errormsg=''):
     localvars = {}
     localvars['errormsg'] = errormsg
     localvars['username'] = username
     localvars['email'] = email
     localvars['fullname'] = fullname
     formatted = evaluate_main('newuser.html', localvars, request=req)
     return Response(formatted)
Beispiel #3
0
	def showAddForm(self, req, username, email, fullname, errormsg=''):
		localvars = {}
		localvars['errormsg'] = errormsg
		localvars['username'] = username
		localvars['email'] = email
		localvars['fullname'] = fullname
		formatted = evaluate_main('newuser.html', localvars, request=req)
		return Response(formatted)
Beispiel #4
0
 def showAddForm(self, req, reposname, errormsg=''):
     templatevars = {}
     templatevars['errormsg'] = errormsg
     templatevars['repository'] = reposname
     templatevars["systems"] = vcs_list()
     formatted = evaluate_main('newrepository.html',
                               templatevars,
                               request=req)
     return Response(formatted)
Beispiel #5
0
    def handler(self, req, path):
        localvars = {}

        if not req.session['user']['is_admin']:
            base_url = options.url_path('base_url_submin')
            username = req.session['user']['name']
            return Redirect(base_url + '/users/show/' + username, req)

        formatted = evaluate_main('intro.html', localvars, request=req)
        return Response(formatted)
Beispiel #6
0
	def handler(self, req, path):
		localvars = {}

		if not req.session['user']['is_admin']:
			base_url = options.url_path('base_url_submin')
			username = req.session['user']['name']
			return Redirect(base_url + '/users/show/' + username, req)

		formatted = evaluate_main('intro.html', localvars, request=req)
		return Response(formatted)
Beispiel #7
0
    def handler(self, req, path):
        localvars = {}

        diagnostics = {}
        diagnostics.update(trac.diagnostics())
        diagnostics.update(svn.diagnostics())
        diagnostics.update(git.diagnostics())
        diagnostics.update(email.diagnostics())
        localvars['diag'] = diagnostics
        localvars['subminenv'] = options.env_path()

        formatted = evaluate_main('diagnostics.html', localvars, request=req)
        return Response(formatted)
Beispiel #8
0
	def handler(self, req, path):
		localvars = {}

		diagnostics = {}
		diagnostics.update(trac.diagnostics())
		diagnostics.update(svn.diagnostics())
		diagnostics.update(git.diagnostics())
		diagnostics.update(email.diagnostics())
		localvars['diag'] = diagnostics
		localvars['subminenv'] = options.env_path()

		formatted = evaluate_main('diagnostics.html', localvars, request=req)
		return Response(formatted)
Beispiel #9
0
    def show(self, req, vcs_type, path, templatevars):
        import os.path

        u = user.User(req.session['user']['name'])
        try:
            repos = Repository(path[0], vcs_type)

            # Lie if user has no permission to read
            if not u.is_admin and not repository.userHasReadPermissions(
                    u.name, path[0], vcs_type):
                raise DoesNotExistError
        except DoesNotExistError:
            return ErrorResponse('This repository does not exist.',
                                 request=req)

        trac_enabled = options.value('enabled_trac', 'no') != 'no'

        if trac_enabled:
            templatevars['trac_config_ok'] = True
            templatevars['trac_exists'] = False
            try:
                if trac.exists(path[0]):
                    templatevars['trac_exists'] = True
            except MissingConfig as e:
                templatevars['trac_config_ok'] = False
                templatevars['trac_msg'] = \
                 'There is something missing in your config: %s' % str(e)

            trac_base_url = options.url_path('base_url_trac')
            trac_http_url = str(trac_base_url + repos.name)
            templatevars['trac_http_url'] = trac_http_url

        try:
            vcs_url = repos.url()
        except MissingConfig as e:
            vcs_url = ""
            templatevars['vcs_url_error'] = str(e)

        templatevars['vcs_url'] = vcs_url
        templatevars['repository'] = repos
        templatevars['vcs_type'] = vcs_type
        formatted = evaluate_main('repositories.html',
                                  templatevars,
                                  request=req)
        return Response(formatted)
Beispiel #10
0
	def show(self, req, path, localvars):
		if len(path) < 1:
			return ErrorResponse('Invalid path', request=req)

		is_admin = req.session['user']['is_admin']
		try:
			g = group.Group(path[0])
		except (IndexError, UnknownGroupError):
			if not is_admin:
				return ErrorResponse('Not permitted', request=req)

			return ErrorResponse('This group does not exist.', request=req)

		if not is_admin and req.session['user']['name'] not in g.members():
			return ErrorResponse('Not permitted', request=req)

		localvars['group'] = g
		formatted = evaluate_main('groups.html', localvars, request=req)
		return Response(formatted)
Beispiel #11
0
    def show(self, req, path, localvars):
        if len(path) < 1:
            return ErrorResponse('Invalid path', request=req)

        is_admin = req.session['user']['is_admin']
        try:
            g = group.Group(path[0])
        except (IndexError, UnknownGroupError):
            if not is_admin:
                return ErrorResponse('Not permitted', request=req)

            return ErrorResponse('This group does not exist.', request=req)

        if not is_admin and req.session['user']['name'] not in g.members():
            return ErrorResponse('Not permitted', request=req)

        localvars['group'] = g
        formatted = evaluate_main('groups.html', localvars, request=req)
        return Response(formatted)
Beispiel #12
0
	def show(self, req, vcs_type, path, templatevars):
		import os.path

		u = user.User(req.session['user']['name'])
		try:
			repos = Repository(path[0], vcs_type)

			# Lie if user has no permission to read
			if not u.is_admin and not repository.userHasReadPermissions(u.name, path[0], vcs_type):
				raise DoesNotExistError
		except DoesNotExistError:
			return ErrorResponse('This repository does not exist.', request=req)

		trac_enabled = options.value('enabled_trac', 'no') != 'no'

		if trac_enabled:
			templatevars['trac_config_ok'] = True
			templatevars['trac_exists'] = False
			try:
				if trac.exists(path[0]):
					templatevars['trac_exists'] = True
			except MissingConfig as e:
				templatevars['trac_config_ok'] = False
				templatevars['trac_msg'] = \
					'There is something missing in your config: %s' % str(e)

			trac_base_url = options.url_path('base_url_trac')
			trac_http_url = str(trac_base_url + repos.name)
			templatevars['trac_http_url'] = trac_http_url

		try:
			vcs_url = repos.url()
		except MissingConfig as e:
			vcs_url = ""
			templatevars['vcs_url_error'] = str(e)

		templatevars['vcs_url'] = vcs_url
		templatevars['repository'] = repos
		templatevars['vcs_type'] = vcs_type
		formatted = evaluate_main('repositories.html', templatevars, request=req)
		return Response(formatted)
Beispiel #13
0
	def show(self, req, path, localvars):
		if len(path) < 1:
			return ErrorResponse('Invalid path', request=req)

		is_admin = req.session['user']['is_admin']
		if not is_admin and path[0] != req.session['user']['name']:
			raise Unauthorized('Permission denied to view this user')

		try:
			u = user.User(path[0])
		except (IndexError, UnknownUserError):
			return ErrorResponse('This user does not exist.', request=req)

		localvars['user'] = u
		if 'change_password_hint' in req.session:
			localvars['change_password_hint'] = True

		localvars['enabled_git'] = 'git' in options.value('vcs_plugins', '')

		formatted = evaluate_main('users.html', localvars, request=req)
		return Response(formatted)
Beispiel #14
0
    def show(self, req, path, localvars):
        if len(path) < 1:
            return ErrorResponse('Invalid path', request=req)

        is_admin = req.session['user']['is_admin']
        if not is_admin and path[0] != req.session['user']['name']:
            raise Unauthorized('Permission denied to view this user')

        try:
            u = user.User(path[0])
        except (IndexError, UnknownUserError):
            return ErrorResponse('This user does not exist.', request=req)

        localvars['user'] = u
        if 'change_password_hint' in req.session:
            localvars['change_password_hint'] = True

        p = list(permissions.list_by_user(u.name))
        localvars['permissions'] = p
        localvars['enabled_git'] = 'git' in options.value('vcs_plugins', '')
        localvars['external'] = u.is_external

        formatted = evaluate_main('users.html', localvars, request=req)
        return Response(formatted)
Beispiel #15
0
	def showAddForm(self, req, groupname, errormsg=''):
		localvars = {}
		localvars['errormsg'] = errormsg
		localvars['groupname'] = groupname
		formatted = evaluate_main('newgroup.html', localvars, request=req)
		return Response(formatted)
Beispiel #16
0
 def showAddForm(self, req, groupname, errormsg=''):
     localvars = {}
     localvars['errormsg'] = errormsg
     localvars['groupname'] = groupname
     formatted = evaluate_main('newgroup.html', localvars, request=req)
     return Response(formatted)