Skip to content

Commit

Permalink
Fixes #38124 - Invalidate tokens for specific user/users (#636)
Browse files Browse the repository at this point in the history
  • Loading branch information
girijaasoni authored Jan 23, 2025
1 parent fd288fe commit fcea924
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
27 changes: 27 additions & 0 deletions lib/hammer_cli_foreman/registration_tokens.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module HammerCLIForeman
class RegistrationTokens < HammerCLIForeman::Command
resource :registration_tokens
command_name 'registration-tokens'
desc _('Manage registration tokens')

class InvalidateMultipleCommand < HammerCLIForeman::DeleteCommand
action :invalidate_jwt_tokens
command_name 'invalidate-multiple'
success_message _('Successfully invalidated registration tokens for %{users}.')
failure_message _('Could not invalidate registration tokens')

build_options
end

class InvalidateCommand < HammerCLIForeman::DeleteCommand
action :invalidate_jwt
command_name 'invalidate'
success_message _('Successfully invalidated registration tokens for %{user}.')
failure_message _('Could not invalidate registration tokens')

build_options
end

autoload_subcommands
end
end
3 changes: 2 additions & 1 deletion lib/hammer_cli_foreman/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ class DeleteCommand < HammerCLIForeman::DeleteCommand
lazy_subcommand('table-preference', _("Managing table preferences"),
'HammerCLIForeman::TablePreference', 'hammer_cli_foreman/table_preference'
)
lazy_subcommand('registration-tokens', _("Managing registration tokens"),
'HammerCLIForeman::RegistrationTokens', 'hammer_cli_foreman/registration_tokens')
autoload_subcommands
end

end

0 comments on commit fcea924

Please sign in to comment.