Cannot Enable Group Access Token after being disabled
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "type::bug" label: - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=type::bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary <!-- Summarize the bug encountered concisely. --> [Group Access Tokens](https://docs.gitlab.com/ee/user/group/settings/group_access_tokens.html#enable-or-disable-group-access-token-creation) can be enabled or disabled by toggling the `Users can create project access tokens and group access tokens in this group` option. However due to a potential regression from this MR: [Policy change to read and destroy token without license for .com](https://gitlab.com/gitlab-org/security/gitlab/-/merge_requests/2914), once this is disabled, the option will disappear and cannot be enabled again. ### Steps to reproduce <!-- Describe how one can reproduce the issue - this is very important. Please use an ordered list. --> 1. Create a top-level group. 2. Go to the group page.' 3. Go to Settings > General > Permissions and group features. 4. Under Permissions, uncheck the `Users can create project access tokens and group access tokens in this group` option. 5. Refresh the page and observe the option is already missing. ### Example Project <!-- If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report. If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version. --> - https://gitlab.com/groups/passwordless/-/edit ### What is the current *bug* behavior? <!-- Describe what actually happens. --> 1. Group administrators are unable to enable group access token again once it is disabled. ### What is the expected *correct* behavior? <!-- Describe what you should see instead. --> 1. Group administrators should be to enable group access token again after disabling it. ### Relevant logs and/or screenshots <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise. --> - Default options when a group is created. ![Screenshot_from_2023-01-20_11-36-38](/uploads/dd4ce47e9e891891372e145e89dc5e0b/Screenshot_from_2023-01-20_11-36-38.png) - Option is missing after disabling it. - ![Screenshot_from_2023-01-20_11-37-08](/uploads/ddd2796aa648cfcc3808df13c05f84af/Screenshot_from_2023-01-20_11-37-08.png) ### Output of checks <!-- If you are reporting a bug on GitLab.com, uncomment below --> This bug happens on GitLab.com <!-- /label ~"reproduced on GitLab.com" --> #### Results of GitLab environment info <!-- Input any relevant GitLab environment information if needed. --> <details> <summary>Expand for output related to GitLab environment info</summary> <pre> (For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`) </pre> </details> #### Results of GitLab application Check <!-- Input any relevant GitLab application check information if needed. --> <details> <summary>Expand for output related to the GitLab application check</summary> <pre> (For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:check SANITIZE=true`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`) (we will only investigate if the tests are passing) </pre> </details> ### Possible fixes <!-- If you can, link to the line of code that might be responsible for the problem. --> - A temporary workaround is to enable it back using the rails console. ``` group = Group.find(GROUPID) group.namespace_settings.update(resource_access_token_creation_allowed: true) ```
issue