summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/node.rb4
-rw-r--r--app/models/user.rb18
2 files changed, 4 insertions, 18 deletions
diff --git a/app/models/node.rb b/app/models/node.rb
index d6fe32ff..f8c29b48 100644
--- a/app/models/node.rb
+++ b/app/models/node.rb
@@ -648,6 +648,10 @@ class Node < ApplicationRecord
648 ) 648 )
649 end 649 end
650 650
651 def embargoed?
652 head&.published_at.present? && head.published_at > Time.zone.now
653 end
654
651 # Nodes are never destroyed recursively 655 # Nodes are never destroyed recursively
652 # Descendants must be removed or reparented individually first. 656 # Descendants must be removed or reparented individually first.
653 # The Trash feature will be the ordinary path to deletion. 657 # The Trash feature will be the ordinary path to deletion.
diff --git a/app/models/user.rb b/app/models/user.rb
index 786f8d14..95706f86 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -70,24 +70,6 @@ class User < ApplicationRecord
70 roles.include?("admin") 70 roles.include?("admin")
71 end 71 end
72 72
73 # Compatibility shims for the users form, which posts user[admin] as a
74 # checkbox. Goes away when that form learns about roles.
75 def admin
76 is_admin?
77 end
78
79 def admin?
80 is_admin?
81 end
82
83 def admin=(value)
84 if ActiveModel::Type::Boolean.new.cast(value)
85 self.roles = (roles | ["admin"])
86 else
87 self.roles = (roles - ["admin"])
88 end
89 end
90
91 def redaktion? 73 def redaktion?
92 roles.include?("redaktion") 74 roles.include?("redaktion")
93 end 75 end