diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2016-10-11 15:25:17 +0300 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2016-11-18 21:25:45 +0300 |
commit | fd05e26618dd0c123ca476b6f5a3d85f1cfe397a (patch) | |
tree | 39a4ac60382ca7ce8d46e3745ba8a381580d6314 /app/models/project_group_link.rb | |
parent | aea8baed3093c513560e9ac5ac0c5c99508d3001 (diff) |
Precalculate user's authorized projects in database
Closes #23150
Diffstat (limited to 'app/models/project_group_link.rb')
-rw-r--r-- | app/models/project_group_link.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/project_group_link.rb b/app/models/project_group_link.rb index db46def11eb..6149c35cc61 100644 --- a/app/models/project_group_link.rb +++ b/app/models/project_group_link.rb @@ -16,6 +16,9 @@ class ProjectGroupLink < ActiveRecord::Base validates :group_access, inclusion: { in: Gitlab::Access.values }, presence: true validate :different_group + after_create :refresh_group_members_authorized_projects + after_destroy :refresh_group_members_authorized_projects + def self.access_options Gitlab::Access.options end @@ -35,4 +38,8 @@ class ProjectGroupLink < ActiveRecord::Base errors.add(:base, "Project cannot be shared with the project it is in.") end end + + def refresh_group_members_authorized_projects + group.refresh_members_authorized_projects + end end |