diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-13 17:46:48 +0300 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-13 17:46:48 +0300 |
| commit | ae564c97d48bf728745c57720734cb40378fd90f (patch) | |
| tree | d9ac31827984c443b9c219deef29309a5e251125 /app/models/user.rb | |
| parent | d5b0f29c4a3a9d7da849d91a16f70bd494831da7 (diff) | |
| download | gitlab-ce-ae564c97d48bf728745c57720734cb40378fd90f.tar.gz | |
Dont expose user email via API
To prevent leaking of users info we reduce amount of user information
retrieved via API for normal users.
What user can get via API:
* if not admin: only id, state, name, username and avatar_url
* if admin: all user information
* about himself: all informaion
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/user.rb')
| -rw-r--r-- | app/models/user.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 0fbc9284dd8..6ad337c57ae 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -482,4 +482,12 @@ class User < ActiveRecord::Base def public_profile? authorized_projects.public_only.any? end + + def avatar_url(size = nil) + if avatar.present? + URI::join(Gitlab.config.gitlab.url, avatar.url).to_s + else + GravatarService.new.execute(email) + end + end end |
