diff options
author | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2017-10-04 13:57:50 +0200 |
---|---|---|
committer | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2018-02-28 09:50:48 +0100 |
commit | 42146c14aab2c110fe021347f213ed7469cf03d8 (patch) | |
tree | 5e3ff140b798ce0fc682a2266357b87c34b03302 | |
parent | 244654fd82b0b8f97446f7c70b9986da1ed91209 (diff) | |
download | gitlab-ce-42146c14aab2c110fe021347f213ed7469cf03d8.tar.gz |
ensure_runners_token on read instead of write
1. we don't want to migrate all existing groups
2. we generate the token when showing the runners page, as this is the
first time that the token will be used.
-rw-r--r-- | app/models/group.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index c4e68fbadcf..914e5129d2c 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -44,7 +44,13 @@ class Group < Namespace validates :two_factor_grace_period, presence: true, numericality: { greater_than_or_equal_to: 0 } add_authentication_token_field :runners_token - before_save :ensure_runners_token + + # each existing group needs to have a `runners_token`. + # we do this on read since migrating all existing groups is not a feasible + # solution. + def runners_token + ensure_runners_token! + end after_create :post_create_hook after_destroy :post_destroy_hook |