aboutsummaryrefslogtreecommitdiffstats
path: root/app/policies
diff options
context:
space:
mode:
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/application_policy.rb2
-rw-r--r--app/policies/boiv_policy.rb4
-rw-r--r--app/policies/default_policy.rb11
-rw-r--r--app/policies/line_policy.rb5
-rw-r--r--app/policies/time_table_policy.rb4
5 files changed, 18 insertions, 8 deletions
diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb
index f2521fa44..e2c0acd8e 100644
--- a/app/policies/application_policy.rb
+++ b/app/policies/application_policy.rb
@@ -53,7 +53,7 @@ class ApplicationPolicy
end
def boiv_read_offer?
- organisation_match? && user.has_permission?('boiv:read-offer')
+ organisation_match? && !(user.permissions || []).grep(%r{\Aboiv:.}).empty?
end
def organisation_match?
diff --git a/app/policies/boiv_policy.rb b/app/policies/boiv_policy.rb
index 444006aa4..aa3ecc50d 100644
--- a/app/policies/boiv_policy.rb
+++ b/app/policies/boiv_policy.rb
@@ -1,10 +1,6 @@
class BoivPolicy < ApplicationPolicy
- def boiv_read_offer?
- organisation_match? && user.has_permission?('boiv:read-offer')
- end
-
def index?
boiv_read_offer?
end
diff --git a/app/policies/default_policy.rb b/app/policies/default_policy.rb
new file mode 100644
index 000000000..efdac1575
--- /dev/null
+++ b/app/policies/default_policy.rb
@@ -0,0 +1,11 @@
+class DefaultPolicy
+
+ def initialize(*args); end
+
+ def create?; true end
+ def destroy?; true end
+ def edit?; true end
+ def index?; true end
+ def show?; true end
+ def update?; true end
+end
diff --git a/app/policies/line_policy.rb b/app/policies/line_policy.rb
index b829040af..1b0d00cc5 100644
--- a/app/policies/line_policy.rb
+++ b/app/policies/line_policy.rb
@@ -6,9 +6,8 @@ class LinePolicy < BoivPolicy
end
end
- def create?
- false
- end
+ def show?; true end
+ def create?; false end
def update? ; false end
def new? ; create? end
def edit? ; false end
diff --git a/app/policies/time_table_policy.rb b/app/policies/time_table_policy.rb
index e915ede6a..a8f54ad48 100644
--- a/app/policies/time_table_policy.rb
+++ b/app/policies/time_table_policy.rb
@@ -6,6 +6,10 @@ class TimeTablePolicy < BoivPolicy
end
end
+ def actualize?
+ !archived? && organisation_match? && edit?
+ end
+
def create?
!archived? && user.has_permission?('time_tables.create') # organisation match via referential is checked in the view
end