Skip to content

Show alert if user todos are hidden due to expired SSO session

Drew Blessing requested to merge dblessing_sso_todos_second_poc into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Resolves https://gitlab.com/gitlab-org/gitlab/-/issues/389379

When a user is a member of a group with SAML SSO for GitLab.com enabled, and hasn't visited a group-level page within the last 24 hours, todos related to that group may be hidden.

While this may not be the ideal long-term solution it is a clear notice to the user that they may have hidden todos and need to re-authenticate to see those todos. The listed groups are only present if the todos point to an object/target in that group hierarchy.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Screenshot_2023-03-20_at_3.02.32_PM

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

How to short circuit to show the UI even when re-auth isn't necessary.

  1. Modify ee/lib/gitlab/auth/group_saml/sso_enforcer.rb and add a return of true to the access_restricted_groups method:
        # Given an array of groups or subgroups, return an array
        # of root groups that are access restricted for the user
        def self.access_restricted_groups(groups, user: nil)
          return [] unless groups&.any?
    
          ::Preloaders::GroupRootAncestorPreloader.new(groups, [:saml_provider]).execute
          root_ancestors = groups.map(&:root_ancestor).uniq
    
          root_ancestors.select do |root_ancestor|
            group_access_restricted?(root_ancestor, user: user, for_project: true)
            true # <-------- ADD THIS HERE 
          end
        end
  2. Refresh/visit /dashboard/todos and the alert should appear.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Drew Blessing

Merge request reports