Count Guests with custom roles as billable users in users statistics
requested to merge 395794-custom-role-elevates-permissions-above-guest-seat-on-the-self-managed-user-stats into master
What does this MR do and why?
This MR changes how we count and show paid users in admin section for self-managed installation on Ultimate Plan - for admin/dashboard/stats
section.
Now we count Guest users with additional custom roles that elevate the guest into the billed seat.
First part of this MR was merged here: !114752 (merged)
Screenshots or screen recordings
Plans:
main: == 20230321085011 AddColumnToUsersStatistisc: migrating =======================
main: -- add_column(:users_statistics, :with_highest_role_guest_with_custom_role, :integer, {:default=>0, :null=>false})
main: -> 0.0070s
main: == 20230321085011 AddColumnToUsersStatistisc: migrated (0.0113s) ==============
ci: == 20230321085011 AddColumnToUsersStatistisc: migrating =======================
ci: -- add_column(:users_statistics, :with_highest_role_guest_with_custom_role, :integer, {:default=>0, :null=>false})
ci: -> 0.0057s
ci: == 20230321085011 AddColumnToUsersStatistisc: migrated (0.0133s) ==============
main: == 20230321085011 AddColumnToUsersStatistisc: reverting =======================
main: -- remove_column(:users_statistics, :with_highest_role_guest_with_custom_role, :integer, {:default=>0, :null=>false})
main: -> 0.0044s
main: == 20230321085011 AddColumnToUsersStatistisc: reverted (0.0119s) ==============
- The only permission we can use right now for testing is
:download_code
, so we need to comment the line 5 in the MemberRole class (the one that adds the thedownload_code
to the ignored columns). - Add
:download_code
to the ALL_CUSTOMIZABLE_PERMISSIONS hash. - Add member role that has
download_code
attribute set to true. - Associate this member role with member of a group on a Guest level.
- See the
Admin > Users
and verify if the guest user with elevating permission is having "Is using seat" badge. - In Rails console run
UsersStatistics.create_current_stats!
- See numbers in
admin/dashboard/stats
section.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #395794 (closed)
Edited by Gosia Ksionek