BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
c6d39a14
Unverified
Commit
c6d39a14
authored
Mar 11, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add User#requires_ldap_check? method
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
cf890b22
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
application_controller.rb
app/controllers/application_controller.rb
+1
-1
user.rb
app/models/user.rb
+11
-1
No files found.
app/controllers/application_controller.rb
View file @
c6d39a14
...
...
@@ -181,7 +181,7 @@ class ApplicationController < ActionController::Base
end
def
ldap_security_check
if
current_user
&&
current_user
.
ldap_user?
&&
current_user
.
requires_ldap_check?
if
current_user
&&
current_user
.
requires_ldap_check?
if
gitlab_ldap_access
.
allowed?
(
current_user
)
current_user
.
last_credential_check_at
=
Time
.
now
current_user
.
save
...
...
app/models/user.rb
View file @
c6d39a14
...
...
@@ -275,7 +275,9 @@ class User < ActiveRecord::Base
# Projects user has access to
def
authorized_projects
@authorized_projects
||=
begin
project_ids
=
(
personal_projects
.
pluck
(
:id
)
+
groups_projects
.
pluck
(
:id
)
+
projects
.
pluck
(
:id
)).
uniq
project_ids
=
personal_projects
.
pluck
(
:id
)
project_ids
+=
groups_projects
.
pluck
(
:id
)
project_ids
+=
projects
.
pluck
(
:id
).
uniq
Project
.
where
(
id:
project_ids
).
joins
(
:namespace
).
order
(
'namespaces.name ASC'
)
end
end
...
...
@@ -406,6 +408,14 @@ class User < ActiveRecord::Base
end
end
def
requires_ldap_check?
if
ldap_user?
!
last_credential_check_at
||
(
last_credential_check_at
+
1
.
hour
)
<
Time
.
now
else
false
end
end
def
solo_owned_groups
@solo_owned_groups
||=
owned_groups
.
select
do
|
group
|
group
.
owners
==
[
self
]
...
...
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