hr_lite 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1716d66b8a6859e70f044dc0025b2052a8085ad83c82567540cbad04a216be9d
4
- data.tar.gz: bc4d26d3c69be4f280e55820672892fac8ae6a93c190be3b6b4272adda7754b2
3
+ metadata.gz: 7ddcf4d252c3b0830d1b345dd44f63dc997cab9db77a408249cd8940ad2256c1
4
+ data.tar.gz: d525ae88d6a0b5c12ca68caff325bb655cd2ff7dfa0ac9afb7f178cbc8d362de
5
5
  SHA512:
6
- metadata.gz: a0ce5511c8c763eac022ee7f900d3c92a0267057c0f6805e49d753076c9c07f6a842285c6d2f034cd3ee6fe40a2343865a4295fd696ef2f0ab4e2a44291c2ffe
7
- data.tar.gz: bdfac21210c1a26383b2d9bed8782f093f651c479e5fe150fad94ad46a012a3612057098d4ea78a8f79f1a80652099c214e47954901cd546a8dd4b340e726b84
6
+ metadata.gz: 155c04f716bbf5907b17ce1dd86c06f44de4f3f8021afda1e2ed3570db8cf14aed2373db7791d4c65441e96b6d4e0318faeb8dc1116b35bea235ed4cb31775d8
7
+ data.tar.gz: be25c7f77087ae53dccb3e991167cc78282de562c5ef9f12739db9bc2bece99ad8b1e743577dc21d3aeb935cd1ca270ae64652bd036459c8c704b438db1ed8c0
data/CHANGELOG.md CHANGED
@@ -7,6 +7,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.8.0] - 2026-08-18
11
+
12
+ The deprecation 0.6.0 opened, closed. **Breaking** only for an install still
13
+ setting `config.legacy_tier_checks`; no migration.
14
+
15
+ ### Removed
16
+
17
+ - **`config.legacy_tier_checks` and the pre-0.6.0 tier lambdas no longer
18
+ decide access.** `HrLite.admin?`, `.leadership?` and `.superadmin?` read
19
+ roles, full stop. Two of those lambdas matched the user's `email` — mutable,
20
+ host-owned, unverified — and a host that kept the flag on kept that hole
21
+ open.
22
+ - The flag is gone from the configuration object entirely, so an initializer
23
+ that still sets it now fails loudly at boot rather than silently doing
24
+ nothing. That is the intended way to find out.
25
+
26
+ ### Changed
27
+
28
+ - `admin_check`, `leadership_emails` / `leadership_check` and
29
+ `superadmin_emails` / `superadmin_check` remain on the configuration, and
30
+ are now **migration input only**: the 0.6.0 upgrade migration reads them to
31
+ derive role assignments. An install jumping 0.5.x → 0.8.0 in one step still
32
+ needs them present for that migration to have something to read, which is
33
+ why they were not deleted outright. Setting them on a current install has no
34
+ effect on who can reach what.
35
+ - `HrLite.leadership_users` and `.admin_users` are one query over the grant
36
+ tables. The legacy paths that instantiated every employee and ran a host
37
+ lambda per row are gone.
38
+
39
+ ### Upgrading
40
+
41
+ If you set `legacy_tier_checks = true`, delete that line. Before you do, open
42
+ the Roles screen and confirm the people who need access hold it — the 0.6.0
43
+ migration will have assigned them already unless you had turned the flag on
44
+ before it ran.
45
+
10
46
  ## [0.7.0] - 2026-08-18
11
47
 
12
48
  Statutory figures stop being code. **Adds one migration** (rate cards and
@@ -513,7 +549,8 @@ Initial release.
513
549
  bus with per-event channel matrix (bell, email, leadership email/bell),
514
550
  daily leadership digest and an append-only audit trail.
515
551
 
516
- [Unreleased]: https://github.com/kshtzkr/hr_lite/compare/v0.7.0...HEAD
552
+ [Unreleased]: https://github.com/kshtzkr/hr_lite/compare/v0.8.0...HEAD
553
+ [0.8.0]: https://github.com/kshtzkr/hr_lite/compare/v0.7.0...v0.8.0
517
554
  [0.7.0]: https://github.com/kshtzkr/hr_lite/compare/v0.6.0...v0.7.0
518
555
  [0.6.0]: https://github.com/kshtzkr/hr_lite/compare/v0.5.3...v0.6.0
519
556
  [0.5.3]: https://github.com/kshtzkr/hr_lite/compare/v0.5.2...v0.5.3
data/README.md CHANGED
@@ -210,8 +210,9 @@ where they already were: `superadmin_emails` to Super Admin,
210
210
  It prints who it put where, and it leaves a host that has already assigned
211
211
  roles by hand alone.
212
212
 
213
- Set `config.legacy_tier_checks = true` to keep the old lambdas in charge while
214
- you migrate. It is honoured for one minor version and removed in 0.8.0.
213
+ As of 0.8.0 those lambdas decide nothing. They are read only by that
214
+ migration, so an install jumping several versions at once still has something
215
+ for it to derive from; setting them on a current install has no effect.
215
216
 
216
217
  ## Features
217
218
 
@@ -15,11 +15,6 @@ HrLite.configure do |c|
15
15
  # HrLite::RoleAssignment.create!(
16
16
  # user_id: User.find_by!(email: "you@example.com").id,
17
17
  # role: HrLite::Role.find_by!(name: HrLite::Role::SUPER_ADMIN))
18
- #
19
- # Upgrading from pre-0.6.0 and not ready to move? Uncomment this and keep
20
- # your leadership_emails / superadmin_emails / admin_check as they were.
21
- # It is honoured until 0.8.0.
22
- # c.legacy_tier_checks = true
23
18
 
24
19
  # Where the portal is reachable (subdomain or path). Enables email link
25
20
  # buttons and HrLite.public_url / HrLite.public_url? for deep links.
@@ -7,11 +7,9 @@ module HrLite
7
7
  :authenticate_method, :admin_check, :display_name_method,
8
8
  :employees_scope, :mentionable_users, :notify, :render_pdf, :company,
9
9
  :time_zone, :currency_symbol, :on_designation_change,
10
- :leadership_emails, :leadership_check, :extra_stylesheets,
11
- :superadmin_emails, :superadmin_check,
10
+ :leadership_emails, :extra_stylesheets, :superadmin_emails,
12
11
  :mailer_from, :public_url_base, :notification_matrix, :back_link,
13
- :onboard_user, :offboard_user, :invite_url_for,
14
- :legacy_tier_checks
12
+ :onboard_user, :offboard_user, :invite_url_for
15
13
 
16
14
  attr_reader :leave_year_start_month
17
15
 
@@ -46,21 +44,20 @@ module HrLite
46
44
  @time_zone = "Asia/Kolkata"
47
45
  @currency_symbol = "₹"
48
46
  @on_designation_change = ->(user, designation) { }
49
- # Access came from three lambdas before 0.6.0, two of which matched the
50
- # user's EMAIL — a mutable, host-owned, unverified column that a host
51
- # then had to remember never to let anyone edit. Roles replace them.
52
- # This flag hands authority back to the old lambdas for a host that has
53
- # not finished migrating; honoured for one more minor version, gone in 0.8.0.
54
- @legacy_tier_checks = false
47
+ # --- pre-0.6.0 access, now MIGRATION INPUT ONLY ------------------------
48
+ #
49
+ # These three governed access until 0.6.0, and two of them matched the
50
+ # user's EMAIL a mutable, host-owned, unverified column that every
51
+ # host then had to remember never to let anybody edit. They decide
52
+ # nothing now: `HrLite.admin?` and friends read roles.
53
+ #
54
+ # They are still read in exactly one place — the 0.6.0 upgrade
55
+ # migration, which derives role assignments from whatever a 0.5.x host
56
+ # had configured. An install upgrading across several versions at once
57
+ # needs them present for that migration to have anything to read, which
58
+ # is why they were not deleted outright.
55
59
  @leadership_emails = []
56
- @leadership_check = ->(user) { HrLite.email_listed?(user, HrLite.config.leadership_emails) }
57
- # Money tier: salary structures, payroll, slips, appraisals. Empty
58
- # list means "same as leadership" (pre-0.5.0 behaviour).
59
60
  @superadmin_emails = []
60
- @superadmin_check = ->(user) do
61
- list = HrLite.normalize_email_list(HrLite.config.superadmin_emails)
62
- list.empty? ? HrLite.leadership?(user) : HrLite.email_listed?(user, list)
63
- end
64
61
  @extra_stylesheets = [] # host stylesheets linked AFTER hr_lite.css (CSS-var overrides)
65
62
  @mailer_from = "hr@example.com"
66
63
  @public_url_base = nil # e.g. "https://hr.example.com" — enables email links + HrLite.public_url
@@ -1,3 +1,3 @@
1
1
  module HrLite
2
- VERSION = "0.7.0"
2
+ VERSION = "0.8.0"
3
3
  end
data/lib/hr_lite.rb CHANGED
@@ -51,62 +51,43 @@ module HrLite
51
51
 
52
52
  def access_for(user) = Access.for(user)
53
53
 
54
- # --- legacy tier predicates --------------------------------------------
54
+ # --- tier predicates ----------------------------------------------------
55
55
  #
56
- # Kept because views, hosts and the notification fan-out all call them.
57
- # They are now READ OFF ROLES rather than off a mutable email column; the
58
- # configured lambdas survive only as an explicit opt-in for a host that
59
- # has not migrated yet (see Configuration#legacy_tier_checks).
56
+ # Shorthands over the permissions, kept because views, hosts and the
57
+ # notification fan-out all read better asking "is this person leadership"
58
+ # than "do they hold profile.manage at all scope". They are ROLES all the
59
+ # way down; the pre-0.6.0 lambdas no longer decide anything.
60
60
 
61
61
  def admin?(user)
62
62
  return false if user.blank?
63
- return !!config.admin_check.call(user) if config.legacy_tier_checks
64
63
 
65
64
  can?(user, "leave.approve", scope: :all) || can?(user, "attendance.manage", scope: :all)
66
65
  end
67
66
 
68
67
  def leadership?(user)
69
68
  return false if user.blank?
70
- return !!config.leadership_check.call(user) if config.legacy_tier_checks
71
69
 
72
70
  can?(user, "profile.manage", scope: :all)
73
71
  end
74
72
 
75
73
  def superadmin?(user)
76
74
  return false if user.blank?
77
- return !!config.superadmin_check.call(user) if config.legacy_tier_checks
78
75
 
79
76
  can?(user, "payroll.manage", scope: :all)
80
77
  end
81
78
 
82
- # An access list, cleaned. "a@x.com,,b@x.com".split(",") one stray
83
- # comma in an ENV var used to put "" in the list, and a user whose
84
- # email was blank then MATCHED it and was handed the tier.
79
+ # An access list, cleaned — read now only by the 0.6.0 upgrade migration.
80
+ # One stray comma in an ENV var ("a@x.com,,b@x.com") used to put "" in the
81
+ # list, and a user whose email was blank then MATCHED it and was handed
82
+ # the tier. Kept honest here so the migration cannot repeat that.
85
83
  def normalize_email_list(emails)
86
84
  Array(emails).map { |e| e.to_s.downcase.strip }.reject(&:empty?)
87
85
  end
88
86
 
89
- # Whether a user's own email is on a configured access list. A blank
90
- # email is never on any list, however the list is spelled.
91
- def email_listed?(user, emails)
92
- address = user.respond_to?(:email) ? user.email.to_s.downcase.strip : ""
93
- return false if address.empty?
94
-
95
- normalize_email_list(emails).include?(address)
96
- end
97
-
98
87
  # Leadership members resolvable to actual user records (for bell
99
- # notifications). On a legacy host, emails configured but absent from the
100
- # user table are still reachable by email — see Notifications.
88
+ # notifications).
101
89
  def leadership_users
102
- unless config.legacy_tier_checks
103
- return users_holding("profile.manage", scope: :all)
104
- end
105
-
106
- emails = normalize_email_list(config.leadership_emails)
107
- return user_klass.none if emails.empty?
108
-
109
- user_klass.where("LOWER(#{user_klass.table_name}.email) IN (?)", emails)
90
+ users_holding("profile.manage", scope: :all)
110
91
  end
111
92
 
112
93
  # Everyone whose roles grant `key` at `scope` or wider. One query over
@@ -121,13 +102,9 @@ module HrLite
121
102
  user_klass.where(id: ids)
122
103
  end
123
104
 
124
- # Every domain event that bells the admins calls this. On roles it is one
125
- # query over the grant tables; on a legacy host it still has to run the
126
- # host's lambda per row, which is why it starts from employees_scope
127
- # (narrowed to real staff) rather than every row that exists.
105
+ # Every domain event that bells the admins calls this. One query over the
106
+ # grant tables it used to instantiate every employee and ask each one.
128
107
  def admin_users
129
- return employees.select { |u| admin?(u) } if config.legacy_tier_checks
130
-
131
108
  users_holding("leave.approve", scope: :all).sort_by { |u| display_name(u).downcase }
132
109
  end
133
110
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hr_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kshitiz sinha