organizations 0.7.0 → 0.7.1

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: 31b245f4e0966a2e2dd4c3eb7f29b6d226981bc608816d7b69e07fe4f8397082
4
- data.tar.gz: 285885977f86a5695f75bc1a2ed6ad4ce63287f76fe7d8b1fa07590e9f13f148
3
+ metadata.gz: fba49577a4eb70a0bd69d5b554609a3a3b5a73046f1b0007219773b2e3cccd48
4
+ data.tar.gz: 8eba41990e24a6558de87d4760fabf09b65561fd43e4314e27f58ec5d838dbc3
5
5
  SHA512:
6
- metadata.gz: 58c3126cda6583ca0b315c784bff2d3a53bb78edd999e32e047c62fcf621bf3f65c0424e682cd8cd3e95eaff8470bae1b35092d8012d4df6a5464b9c4c40e036
7
- data.tar.gz: e52343ef673c5279f35ac7ba765188dcc3715daee9581fc847704d93065d4f4612c23d3fe6d314b8f4b017e6794ae6f8c9fab708c5a61052fd6939dc3486278d
6
+ metadata.gz: f49c6a4eba6854e3988c2a39d175f5616af10ef8723e3c6f91d461ca8f3bc4151cb9ddc64e0baf5ff5a83e474690eacc86362d149354c46e72c97b92bf2e9c7a
7
+ data.tar.gz: 9b83cc21331c095d64ea22ba5f4874a11716e634f2dffd664a7b5b3ed4768c9ac048e2f03a4c93bddd92e3661d6003dceeac0edc21f671c5ff327dff4241490e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.7.1] - 2026-10-19
4
+
5
+ **A user whose invitation was accepted can now be deleted.** A patch release with one fix and one README correction. No migration is needed.
6
+
7
+ ### Fixed
8
+
9
+ - **A user whose invitation was accepted could not be deleted.** Accepting an invitation copies the inviter into `organizations_memberships.invited_by_id`, whose foreign key has no `ON DELETE` rule, and nothing cleared it. `user.destroy` raised `ActiveRecord::InvalidForeignKey` and rolled back, whatever `account_deletion_policy` said. `has_organizations` now declares `invited_organization_memberships` with `dependent: :nullify`, as it does for sent invitations. No migration is needed. A deletion path that skips callbacks (`delete`, raw SQL) still meets the foreign key: give it `ON DELETE SET NULL` in your own migration if you have one.
10
+ - README: the scoped resource grants example redefined only `viewer` and `member` in `config.roles`. A block that redefines a built-in role defines only the built-in roles it lists, so `admin` and `owner` were left with no permissions. The example now lists all four roles.
11
+
3
12
  ## [0.7.0] - 2026-10-18
4
13
 
5
14
  **Personal organizations, safe account deletion, domain authority, join screens, vocabularies and scoped resource grants.** This release closes issue #21. Every new feature is opt-in: an existing app that upgrades and runs `rails g organizations:upgrade` keeps its behaviour, apart from the changes listed under "Changed".
data/README.md CHANGED
@@ -1012,19 +1012,36 @@ rails db:migrate
1012
1012
  Capabilities are checked against the role's permissions, so give your roles the capabilities they may use on granted records (custom roles work too):
1013
1013
 
1014
1014
  ```ruby
1015
+ # A block that redefines a built-in role defines only the built-in roles it
1016
+ # lists, so list all four: these are the defaults plus the capabilities.
1015
1017
  config.roles do
1016
1018
  role :viewer do
1017
1019
  can :view_organization
1020
+ can :view_members
1018
1021
  can :read
1019
1022
  end
1020
1023
  role :client, inherits: :viewer do # a narrow custom role
1021
1024
  can :comment
1022
1025
  end
1023
1026
  role :member, inherits: :viewer do
1027
+ can :create_resources
1028
+ can :edit_own_resources
1029
+ can :delete_own_resources
1024
1030
  can :comment
1025
1031
  can :edit
1026
1032
  end
1027
- # admin and owner as usual (they inherit member)
1033
+ role :admin, inherits: :member do
1034
+ can :invite_members
1035
+ can :remove_members
1036
+ can :edit_member_roles
1037
+ can :manage_settings
1038
+ can :view_billing
1039
+ end
1040
+ role :owner, inherits: :admin do
1041
+ can :manage_billing
1042
+ can :transfer_ownership
1043
+ can :delete_organization
1044
+ end
1028
1045
  end
1029
1046
  ```
1030
1047
 
@@ -105,6 +105,13 @@ module Organizations
105
105
  inverse_of: :invited_by,
106
106
  dependent: :nullify
107
107
 
108
+ # Memberships those invitations became. Nullified on deletion like
109
+ # the invitations: the install migration gives invited_by_id a
110
+ # foreign key with no ON DELETE rule, so without this the database
111
+ # refuses to delete anyone whose invitation was accepted.
112
+ has_many :invited_organization_memberships, class_name: "Organizations::Membership",
113
+ foreign_key: :invited_by_id, inverse_of: :invited_by, dependent: :nullify
114
+
108
115
  define_verified_joining_associations
109
116
  end
110
117
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Organizations
4
- VERSION = "0.7.0"
4
+ VERSION = "0.7.1"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: organizations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - rameerez
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-10-18 00:00:00.000000000 Z
10
+ date: 2026-10-19 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: railties