Add pickups role
This commit is contained in:
parent
4c41a99fde
commit
ac11ba1cc1
14 changed files with 42 additions and 15 deletions
|
|
@ -68,9 +68,11 @@ class ApplicationController < ActionController::Base
|
|||
when "admin" then current_user.role_admin?
|
||||
when "finance" then current_user.role_finance?
|
||||
when "article_meta" then current_user.role_article_meta?
|
||||
when "pickups" then current_user.role_pickups?
|
||||
when "suppliers" then current_user.role_suppliers?
|
||||
when "orders" then current_user.role_orders?
|
||||
when "finance_or_orders" then (current_user.role_finance? || current_user.role_orders?)
|
||||
when "pickups_or_orders" then (current_user.role_pickups? || current_user.role_orders?)
|
||||
when "any" then true # no role required
|
||||
else false # any unknown role will always fail
|
||||
end
|
||||
|
|
@ -81,19 +83,23 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def authenticate_admin
|
||||
authenticate('admin')
|
||||
end
|
||||
|
||||
|
||||
def authenticate_finance
|
||||
authenticate('finance')
|
||||
end
|
||||
|
||||
|
||||
def authenticate_article_meta
|
||||
authenticate('article_meta')
|
||||
end
|
||||
|
||||
def authenticate_pickups
|
||||
authenticate('pickups')
|
||||
end
|
||||
|
||||
def authenticate_suppliers
|
||||
authenticate('suppliers')
|
||||
end
|
||||
|
|
@ -106,6 +112,10 @@ class ApplicationController < ActionController::Base
|
|||
authenticate('finance_or_orders')
|
||||
end
|
||||
|
||||
def authenticate_pickups_or_orders
|
||||
authenticate('pickups_or_orders')
|
||||
end
|
||||
|
||||
# checks if the current_user is member of given group.
|
||||
# if fails the user will redirected to startpage
|
||||
def authenticate_membership_or_admin(group_id = params[:id])
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
# Normal ordering actions of members of order groups is handled by the OrderingController.
|
||||
class OrdersController < ApplicationController
|
||||
|
||||
before_filter :authenticate_orders
|
||||
before_filter :authenticate_pickups_or_orders
|
||||
before_filter :authenticate_orders, except: [:receive, :receive_on_order_article_create, :receive_on_order_article_update, :show]
|
||||
before_filter :remove_empty_article, only: [:create, :update]
|
||||
|
||||
# List orders
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
class PickupsController < ApplicationController
|
||||
|
||||
before_filter :authenticate_pickups
|
||||
|
||||
def index
|
||||
@orders = Order.finished_not_closed.order('pickup DESC').group_by { |o| o.pickup }
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue