Follow-up from "Add groups to CI_JOB_TOKEN allowlist, groups validation implementation"

The following discussion from !142441 (merged) should be addressed:

  • @iamricecake started a discussion:

    I think we can now use the parent_groups method to replace all_parent_groups = Gitlab::ObjectHierarchy.new(Group.where(id: group)).base_and_ancestors. But no worries, can be done in a follow-up.

Proposal

The enforced_runner_token_expiration_interval method in the app/models/project.rb file can be refactored to use the parent_groups method defined above it.

Edited by Jayakrishnan Mallissery