Sha256: 27f8825332a7fe4b8e7a5aa9390846bbf24259e7e3a632521a3e40072f52d1c3

Contents?: true

Size: 533 Bytes

Versions: 1

Compression:

Stored size: 533 Bytes

Contents

module Underworld
  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 = []

          Underworld::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

1 entries across 1 versions & 1 rubygems

Version Path
underworld-1.0.0 lib/underworld/api/permissions_api.rb