Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7fe779b8
Commit
7fe779b8
authored
Aug 05, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add/remove user to appropriate groups based on LDAP settings
parent
4b3fa67c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
0 deletions
+57
-0
app/views/admin/groups/edit.html.haml
app/views/admin/groups/edit.html.haml
+6
-0
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+40
-0
lib/gitlab/ldap/person.rb
lib/gitlab/ldap/person.rb
+11
-0
No files found.
app/views/admin/groups/edit.html.haml
View file @
7fe779b8
...
@@ -26,6 +26,12 @@
...
@@ -26,6 +26,12 @@
%li
It will change web url for access group and group projects.
%li
It will change web url for access group and group projects.
%li
It will change the git path to repositories under this group.
%li
It will change the git path to repositories under this group.
.clearfix
=
f
.
label
:ldap_cn
do
LDAP Group cn
.input
=
f
.
text_field
:ldap_cn
,
class:
"xxlarge left"
.form-actions
.form-actions
=
f
.
submit
'Save changes'
,
class:
"btn btn-primary"
=
f
.
submit
'Save changes'
,
class:
"btn btn-primary"
=
link_to
'Cancel'
,
admin_groups_path
,
class:
"btn btn-cancel"
=
link_to
'Cancel'
,
admin_groups_path
,
class:
"btn btn-cancel"
lib/gitlab/ldap/access.rb
0 → 100644
View file @
7fe779b8
#-------------------------------------------------------------------
#
# The GitLab Enterprise Edition (EE) license
#
# Copyright (c) 2013 GitLab.com
#
# All Rights Reserved. No part of this software may be reproduced without
# prior permission of GitLab.com. By using this software you agree to be
# bound by the GitLab Enterprise Support Subscription Terms.
#
#-------------------------------------------------------------------
module
Gitlab
module
LDAP
class
Access
def
update_permissions
(
user
)
ldap_user
=
Gitlab
::
LDAP
::
Person
.
find
(
user
.
extern_uid
)
ldap_groups
=
ldap_user
.
groups
ldap_groups_cn
=
ldap_groups
.
map
(
&
:name
)
groups
=
::
Group
.
where
(
ldap_cn:
ldap_groups_cn
)
# First lets add user to new groups
groups
.
each
do
|
group
|
group
.
add_users
([
user
.
id
],
UsersGroup
::
DEVELOPER
)
end
# Remove groups with LDAP if user lost access to it
user
.
authorized_groups
.
where
(
'ldap_cn IS NOT NULL'
).
each
do
|
group
|
if
ldap_groups_cn
.
include?
(
group
.
ldap_cn
)
# ok user still in group
else
# user lost access to this group in ldap
membership
=
group
.
users_groups
.
where
(
user_id:
user
.
id
).
last
membership
.
destroy
if
membership
end
end
end
end
end
end
lib/gitlab/ldap/person.rb
View file @
7fe779b8
...
@@ -13,6 +13,17 @@
...
@@ -13,6 +13,17 @@
module
Gitlab
module
Gitlab
module
LDAP
module
LDAP
class
Person
class
Person
def
self
.
find
(
user_uid
)
uid
=
if
user_uid
=~
/uid=([a-zA-Z0-9.-]+)/
$1
else
user_uid
end
Gitlab
::
LDAP
::
Adapter
.
new
.
user
(
uid
)
end
def
initialize
(
entry
)
def
initialize
(
entry
)
@entry
=
entry
@entry
=
entry
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment