diff options
Diffstat (limited to 'doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md')
-rw-r--r-- | doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md b/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md index 265c5278fd6..1c948771f5b 100644 --- a/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md +++ b/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md @@ -771,6 +771,26 @@ group.require_two_factor_authentication=false group.save ``` +### Check and toggle a feature for all projects in a group + +```ruby +projects = Group.find_by_name('_group_name').projects +projects.each do |p| + state = p.<feature-name>? + + if state + puts "#{p.name} has <feature-name> already enabled. Skipping..." + else + puts "#{p.name} didn't have <feature-name> enabled. Enabling..." + p.project_feature.update!(builds_access_level: ProjectFeature::PRIVATE) + end +end +``` + +To find features that can be toggled, run `pp p.project_feature`. +Available permission levels are listed in +[concerns/featurable.rb](https://gitlab.com/gitlab-org/gitlab/blob/master/app/models/concerns/featurable.rb). + ## Authentication ### Re-enable standard web sign-in form @@ -1023,7 +1043,7 @@ This is needed for example in a known edge-case with ### Remove licenses -To clean up the [License History table](../../user/admin_area/license.md#view-license-details-and-history): +To clean up the [License History table](../../user/admin_area/license_file.md#view-license-details-and-history): ```ruby TYPE = :trial? |