Sha256: d15838d8da9104c5ad080b23b5ab56da7c07e5dcb0ff55120dd466840e9a65e3
Contents?: true
Size: 894 Bytes
Versions: 23
Compression:
Stored size: 894 Bytes
Contents
module MnoEnterprise class Jpi::V1::BaseResourceController < ApplicationController before_filter :check_authorization protected def timestamp @timestamp ||= (params[:timestamp] || 0).to_i end def parent_organization @parent_organization ||= current_user.organizations.to_a.find do |o| key = (params[:organization_id].to_i == 0) ? o.uid : o.id.to_s key == params[:organization_id].to_s end end # Check current user is logged in # Check organization is valid if specified def check_authorization unless current_user render nothing: true, status: :unauthorized return false end if params[:organization_id] && !parent_organization render nothing: true, status: :forbidden return false end true end end end
Version data entries
23 entries across 23 versions & 1 rubygems