コード例 #1
0
def merge_users(email):
    """merge the scm user into ldap user
    """
    if not email:
        return

    # get the user which is from LDAP
    users = User.objects.filter(email=email).exclude(username=email)

    def updata_role(role, old, new):
        role.user_set.remove(old)
        role.user_set.add(new)

    if len(users) == 1:
        user = users[0]
        # get the user which is from scm
        try:
            ur = User.objects.get(username=email)
        except User.DoesNotExist:
            return

        if user.username != ur.email:
            # merge it into ldap user then delete it
            ogetter = inject_user_getters(ur)
            for role in ogetter.get_domainroles():
                updata_role(role, ur, user)
            for role in ogetter.get_subdomainroles():
                updata_role(role, ur, user)
            for role in ogetter.get_gittreeroles():
                updata_role(role, ur, user)
            # merge submissions to ladp user
            ur.submission_set.update(owner=user)
            ur.delete()
コード例 #2
0
ファイル: scm.py プロジェクト: 01org/iris-panel
def merge_users(email):
    """merge the scm user into ldap user
    """
    if not email:
        return

    # get the user which is from LDAP
    users = User.objects.filter(email=email).exclude(username=email)

    def updata_role(role, old, new):
        role.user_set.remove(old)
        role.user_set.add(new)

    if len(users) == 1:
        user = users[0]
        # get the user which is from scm
        try:
            ur = User.objects.get(username=email)
        except User.DoesNotExist:
            return

        if user.username != ur.email:
            # merge it into ldap user then delete it
            ogetter = inject_user_getters(ur)
            for role in ogetter.get_domainroles():
                updata_role(role, ur, user)
            for role in ogetter.get_subdomainroles():
                updata_role(role, ur, user)
            for role in ogetter.get_gittreeroles():
                updata_role(role, ur, user)
            # merge submissions to ladp user
            ur.submission_set.update(owner=user)
            ur.delete()
コード例 #3
0
ファイル: base.py プロジェクト: pombreda/iris-panel
def users(request, pkid=None):
    """
    Returns IRIS user list.
    """

    if pkid:
        user = inject_user_getters(get_object_or_404(User, id=pkid))
        return render(request, 'core/user.html', {'User': user})
    else:
        return render(request, 'core/users.html',
                      {'users': User.objects.all()})
コード例 #4
0
ファイル: base.py プロジェクト: 01org/iris-panel
def users(request, pkid=None):
    """
    Returns IRIS user list.
    """

    if pkid:
        user = inject_user_getters(get_object_or_404(User, id=pkid))
        return render(request, 'core/user.html',
                {'User': user})
    else:
        return render(request, 'core/users.html',
                {'users': User.objects.all()})