Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions 21 docs/gl_objects/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,24 @@
# or
member.delete()
# end member delete

# ldap sync list
group.ldap_group_links
# end ldap sync list

# ldap sync create
gl.group_ldap_links.create({'cn': 'some_ldap_group_name',
'provider': 'ldapmain', 'group_access': 50},
group_id=1)
# or
group.ldaplinks.create({'cn': 'some_ldap_group_name',
'provider': 'ldapmain', 'group_access': 50})
# end ldap sync create

# ldap sync delete
gl.group_ldap_links.delete('some_ldap_group_name', group_id=1)
# or
group.ldaplinks.delete('some_ldap_group_name')
# or
ldaplink.delete()
# end ldap sync delete
12 changes: 12 additions & 0 deletions 12 docs/gl_objects/groups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,15 @@ Remove a member from the group:
.. literalinclude:: groups.py
:start-after: # member delete
:end-before: # end member delete

Add an LDAP group for synchronization:

.. literalinclude:: groups.py
:start-after: # ldap sync create
:end-before: # end ldap sync create

Remove an LDAP group for synchronization:

.. literalinclude:: groups.py
:start-after: # ldap sync delete
:end-before: # end ldap sync delete
2 changes: 1 addition & 1 deletion 2 gitlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def delete(self, obj, id=None, **kwargs):
if k not in params:
try:
params[k] = getattr(obj, k)
except KeyError:
except AttributeError:
missing.append(k)
if missing:
raise GitlabDeleteError('Missing attribute(s): %s' %
Expand Down
17 changes: 16 additions & 1 deletion 17 gitlab/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,20 @@ class GroupIssueManager(BaseManager):
obj_cls = GroupIssue


class GroupLdapSyncLink(GitlabObject):
_url = '/groups/%(group_id)s/ldap_group_links'
idAttr = 'cn'
canGet = False
canList = False
canUpdate = False
requiredUrlAttrs = ['group_id']
requiredCreateAttrs = ['cn', 'group_access', 'provider']


class GroupLdapSyncLinkManager(BaseManager):
obj_cls = GroupLdapSyncLink


class GroupMember(GitlabObject):
_url = '/groups/%(group_id)s/members'
canGet = 'from_list'
Expand Down Expand Up @@ -807,7 +821,8 @@ class Group(GitlabObject):
('accessrequests', GroupAccessRequestManager, [('group_id', 'id')]),
('members', GroupMemberManager, [('group_id', 'id')]),
('projects', GroupProjectManager, [('group_id', 'id')]),
('issues', GroupIssueManager, [('group_id', 'id')])
('issues', GroupIssueManager, [('group_id', 'id')]),
('ldaplinks', GroupLdapSyncLinkManager, [('group_id', 'id')]),
]

GUEST_ACCESS = gitlab.GUEST_ACCESS
Expand Down
4 changes: 2 additions & 2 deletions 4 tools/build_test_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ cleanup() {
}

try docker run --name gitlab-test --detach --publish 8080:80 \
--publish 2222:22 gpocentek/test-python-gitlab:latest >/dev/null
--publish 2222:22 costela/test-python-gitlab:latest >/dev/null

LOGIN='root'
PASSWORD='5iveL!fe'
Expand All @@ -100,7 +100,7 @@ while :; do
curl -s http://localhost:8080/users/sign_in 2>/dev/null \
| grep -q "GitLab Community Edition" && break
I=$((I+5))
[ "$I" -lt 120 ] || fatal "timed out"
[ "$I" -lt 300 ] || fatal "timed out"
done
sleep 5

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.