Alpine icon indicating copy to clipboard operation
Alpine copied to clipboard

Add getTeams() to Principal contract

Open mulder999 opened this issue 2 years ago • 0 comments

Rational: Common to ApiKey and UserPrincipal.

OO simplification to avoid this type of ugly code:

            final List<Team> teams;
            if (principal instanceof UserPrincipal) {
                final UserPrincipal userPrincipal = ((UserPrincipal) principal);
                teams = userPrincipal.getTeams();
         
            } else {
                final ApiKey apiKey = ((ApiKey) principal);
                teams = apiKey.getTeams();
            }

mulder999 avatar Dec 22 '22 14:12 mulder999