summaryrefslogtreecommitdiff
path: root/app/models/permission.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-31 14:35:16 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-31 14:35:16 +0200
commit5f17f421b176d48ef556fb379f59bbb7d284b48e (patch)
tree15f07f480b07c385c88d43f827fc452b5b9df21a /app/models/permission.rb
parenta90a77cfb913c7c0444ec793b47fd4be6fb66c9f (diff)
Retire the unused per-node permission subsystem
Every path through Permission raised or lied: validates_presence_of on a boolean made granted = false unsaveable, since false.blank? is true; get_permission_for read a nonexistent identifier attribute; has_permission? called an undefined plural method and returned a truthy relation in every case; and set_permission mutated granted without saving. Nothing outside the model referenced it and the table was empty.
Diffstat (limited to 'app/models/permission.rb')
-rw-r--r--app/models/permission.rb13
1 files changed, 0 insertions, 13 deletions
diff --git a/app/models/permission.rb b/app/models/permission.rb
deleted file mode 100644
index 1383a4b8..00000000
--- a/app/models/permission.rb
+++ /dev/null
@@ -1,13 +0,0 @@
1class Permission < ApplicationRecord
2 # Validations
3 validates_presence_of :user_id, :node_id, :granted
4 validates_inclusion_of :granted, :in => [true, false]
5
6 # Associations
7 belongs_to :user
8 belongs_to :node
9
10 # Named scopes
11 scope :for_node, ->(node) { where('node_id = ?', (node.is_a?(Node) ? node.id : node)) }
12 scope :for_user, ->(user) { where('user_id = ?', (user.is_a?(User) ? user.id : user)) }
13end