Sha256: 3f921a4a9a373dfb9125691450901212072f1c4053f510c0dfdc2e2beba398ca

Contents?: true

Size: 527 Bytes

Versions: 3

Compression:

Stored size: 527 Bytes

Contents

module RedBase
  module API
    class PermissionsAPI < Grape::API

      resource :permissions do

        desc "Return all permissions available"
        get do
          authenticated_user
          # TODO: Check for admin user only
          permissions = []

          RedBase::Engine.models_with_permission.each do |model|
            model = Object.const_get(model)
            permissions.concat(model::Permissions.permission_strings(model))
          end

          permissions
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
red_base-0.6.0 lib/red_base/api/permissions_api.rb
red_base-0.5.1 lib/red_base/api/permissions_api.rb
red_base-0.5.0 lib/red_base/api/permissions_api.rb