• Icon: Suggestion Suggestion
    • Resolution: Fixed
    • 5.0.0, 4.14.4
    • None
    • None
    • We collect Bitbucket feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      The userAdminService.revokeAllGlobalPermissions can get ClassCastException if you pass DetailedUser object instead of ApplicationUser from userService.

            [BSERV-9648] InternalConverter does not know about DetailedUser

            Thanks a lot, Bryan!

            Alexey Efimov added a comment - Thanks a lot, Bryan!

            Bryan Turner (Inactive) added a comment - - edited

            Alexey,

            I've made a small change to InternalConverter that may help with this. Since this isn't a pressing issue, it by itself won't prompt us to cut 4.14.4. But I've included it on the branch, so when the next bugfix release for 4.14 is built this change will be in it. You've indicated before that you already monitor for releases, so I'm sure you'll see it when it happens!

            Best regards,
            Bryan Turner
            Atlassian Bitbucket

            Bryan Turner (Inactive) added a comment - - edited Alexey, I've made a small change to InternalConverter that may help with this. Since this isn't a pressing issue, it by itself won't prompt us to cut 4.14.4. But I've included it on the branch, so when the next bugfix release for 4.14 is built this change will be in it. You've indicated before that you already monitor for releases, so I'm sure you'll see it when it happens! Best regards, Bryan Turner Atlassian Bitbucket

            Hello Bryan,

            We have job, that monitored users who no longer used Bitbucket for a long time. This required us to get DetailedUser (it has last auth timestamp). For such users we need to revoke License. But instead of error now we have follow code:

             

            // Avoid ClassCastException
            // See https://jira.atlassian.com/browse/BSERV-9648
            ApplicationUser applicationUser = userService.getUserById(user.getId());
            if (applicationUser == null) {
             throw new IllegalStateException("User not found " + user.getName());
            }
            permissionAdminService.revokeAllGlobalPermissions(applicationUser); 
            

             

            Alexey Efimov added a comment - Hello Bryan, We have job, that monitored users who no longer used Bitbucket for a long time. This required us to get DetailedUser (it has last auth timestamp). For such users we need to revoke License. But instead of error now we have follow code:   // Avoid ClassCastException // See https://jira.atlassian.com/browse/BSERV-9648 ApplicationUser applicationUser = userService.getUserById(user.getId()); if (applicationUser == null ) { throw new IllegalStateException( "User not found " + user.getName()); } permissionAdminService.revokeAllGlobalPermissions(applicationUser);   

            Alexey,

            This is a little bit of a "then don't do that" situation. Why are you passing a DetailedUser? While DetailedUser might extend ApplicationUser, it's not intended to be used as an input to anything. It's an output that adds some additional details for use on certain UI screens.

            There's a pretty low likelihood we'll do anything to change this. Why are you hitting it?

            Best regards,
            Bryan Turner
            Atlassian Bitbucket

            Bryan Turner (Inactive) added a comment - - edited Alexey, This is a little bit of a "then don't do that" situation. Why are you passing a DetailedUser ? While DetailedUser might extend ApplicationUser , it's not intended to be used as an input to anything. It's an output that adds some additional details for use on certain UI screens. There's a pretty low likelihood we'll do anything to change this. Why are you hitting it? Best regards, Bryan Turner Atlassian Bitbucket

              bturner Bryan Turner (Inactive)
              3652ed9ede2e Alexey Efimov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: