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
15b248b2
Commit
15b248b2
authored
Aug 15, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add backwards compatible accessors for ldap_cn and ldap_access
parent
3ba7a3a5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
7 deletions
+30
-7
app/models/group.rb
app/models/group.rb
+17
-0
db/migrate/20140813090117_add_ldap_groups_table.rb
db/migrate/20140813090117_add_ldap_groups_table.rb
+0
-6
db/migrate/20140813133925_rename_ldap_group_to_ldap_group_link.rb
...te/20140813133925_rename_ldap_group_to_ldap_group_link.rb
+13
-1
No files found.
app/models/group.rb
View file @
15b248b2
...
...
@@ -80,4 +80,21 @@ class Group < Namespace
def
public_profile?
projects
.
public_only
.
any?
end
# NOTE: Backwards compatibility with old ldap situation
def
ldap_cn
ldap_group_links
.
first
.
try
(
:cn
)
end
def
ldap_access
ldap_group_links
.
first
.
try
(
:group_access
)
end
def
old_ldap_cn
read_attribute
(
:ldap_cn
)
end
def
old_ldap_access
read_attribute
(
:ldap_access
)
end
end
db/migrate/20140813090117_add_ldap_groups_table.rb
View file @
15b248b2
...
...
@@ -7,12 +7,6 @@ class AddLdapGroupsTable < ActiveRecord::Migration
t
.
timestamps
end
Group
.
where
.
not
(
ldap_cn:
nil
).
each
do
|
group
|
group
.
ldap_groups
.
where
(
cn:
group
.
ldap_cn
).
first_or_create
do
|
ldap_group
|
ldap_group
.
group_access
=
group
.
ldap_access
end
end
end
def
down
...
...
db/migrate/20140813133925_rename_ldap_group_to_ldap_group_link.rb
View file @
15b248b2
class
RenameLdapGroupToLdapGroupLink
<
ActiveRecord
::
Migration
def
change
def
up
rename_table
:ldap_groups
,
:ldap_group_links
# NOTE: we use the old_ methods because the new methods are overloaded
# for backwards compatibility
Group
.
where
.
not
(
ldap_cn:
nil
).
each
do
|
group
|
group
.
ldap_group_links
.
where
(
cn:
group
.
old_ldap_cn
).
first_or_create
do
|
ldap_group_link
|
ldap_group_link
.
group_access
=
group
.
old_ldap_access
end
end
end
def
down
rename_table
:ldap_group_links
,
:ldap_groups
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