def export_authz(**kwargs):
    """Export authorization/authentication info"""
    # XXX the import here is to prevent a circular import :( design problem!
    from .repository import list as list_repos

    authz_filename = options.env_path("svn_authz_file")
    authz = codecs.open(str(authz_filename), "w+", "utf-8")

    # Write all groups
    authz.write("[groups]\n")
    for groupname in group.list(FakeAdminUser()):
        g = group.Group(groupname)
        authz.write("%s = %s\n" % (groupname, ', '.join(g.members())))
    authz.write("\n")

    # Write all repositories and their permissions
    for repository in list_repos():
        if repository["status"] != "ok":
            continue

        for path in permissions.list_paths(repository["name"], "svn"):
            authz.write("[%s:%s]\n" % (repository["name"], path))

            for perm in permissions.list_by_path(repository["name"], "svn",
                                                 path):
                if perm["type"] == "group":
                    authz.write("@")
                authz.write("%s = %s\n" % (perm["name"], perm["permission"]))
            authz.write("\n")

    authz.close()
Exemple #2
0
    def getpermissions(self, req, repos):
        session_user = req.session['user']
        asking_user = user.User(session_user['name'])
        path = req.post.get('getPermissions')
        branch_or_path = Path(path)
        if not repos.has_path_permissions:
            branch_or_path = branch_or_path.lstrip('/')

        perms = permissions.list_by_path(repos.name, repos.vcs_type, path)

        usernames = []
        if 'userlist' in req.post:
            usernames = user.list(asking_user)

        groupnames = []
        if 'grouplist' in req.post:
            groupnames = group.list(asking_user)

        templatevars = {
            'perms': perms,
            'repository': repos.name,
            'path': branch_or_path,
            'usernames': usernames,
            'groupnames': groupnames
        }
        return XMLTemplateResponse('ajax/repositoryperms.xml', templatevars)
Exemple #3
0
def export_authz(**kwargs):
	"""Export authorization/authentication info"""
	# XXX the import here is to prevent a circular import :( design problem!
	from .repository import list as list_repos

	authz_filename = options.env_path("svn_authz_file")
	authz = codecs.open(str(authz_filename), "w+", "utf-8")

	# Write all groups
	authz.write("[groups]\n")
	for groupname in group.list(FakeAdminUser()):
		g = group.Group(groupname)
		authz.write("%s = %s\n" % (groupname, ', '.join(g.members())))
	authz.write("\n")

	# Write all repositories and their permissions
	for repository in list_repos():
		if repository["status"] != "ok":
			continue

		for path in permissions.list_paths(repository["name"], "svn"):
			authz.write("[%s:%s]\n" % (repository["name"], path))

			for perm in permissions.list_by_path(repository["name"], "svn", path):
				if perm["type"] == "group":
					authz.write("@")
				authz.write("%s = %s\n" % (perm["name"], perm["permission"]))
			authz.write("\n")

	authz.close()
Exemple #4
0
	def getpermissions(self, req, repos):
		session_user = req.session['user']
		asking_user = user.User(session_user['name'])
		path = req.post.get('getPermissions')
		branch_or_path = Path(path)
		if not repos.has_path_permissions:
			branch_or_path = branch_or_path.lstrip('/')

		perms = permissions.list_by_path(repos.name,
				repos.vcs_type, path)

		usernames = []
		if 'userlist' in req.post:
			usernames = user.list(asking_user)

		groupnames = []
		if 'grouplist' in req.post:
			groupnames = group.list(asking_user)

		templatevars = {'perms': perms, 'repository': repos.name,
			'path': branch_or_path, 'usernames': usernames,
			'groupnames': groupnames}
		return XMLTemplateResponse('ajax/repositoryperms.xml', templatevars)