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 +4 -4
- data/CHANGELOG.md +38 -1
- data/README.md +3 -2
- data/lib/generators/hr_lite/install/templates/initializer.rb +0 -5
- data/lib/hr_lite/configuration.rb +14 -17
- data/lib/hr_lite/version.rb +1 -1
- data/lib/hr_lite.rb +13 -36
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7ddcf4d252c3b0830d1b345dd44f63dc997cab9db77a408249cd8940ad2256c1
|
|
4
|
+
data.tar.gz: d525ae88d6a0b5c12ca68caff325bb655cd2ff7dfa0ac9afb7f178cbc8d362de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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
|
-
|
|
214
|
-
|
|
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, :
|
|
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
|
-
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
|
|
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
|
data/lib/hr_lite/version.rb
CHANGED
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
|
-
# ---
|
|
54
|
+
# --- tier predicates ----------------------------------------------------
|
|
55
55
|
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
#
|
|
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
|
|
83
|
-
# comma in an ENV var
|
|
84
|
-
# email was blank then MATCHED it and was handed
|
|
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).
|
|
100
|
-
# user table are still reachable by email — see Notifications.
|
|
88
|
+
# notifications).
|
|
101
89
|
def leadership_users
|
|
102
|
-
|
|
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.
|
|
125
|
-
#
|
|
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
|
|