Sha256: 9bfcc0528d0572d87f9cfd04aece274bc8bee4b6d514f0f6910831dceb2dcae4

Contents?: true

Size: 543 Bytes

Versions: 16

Compression:

Stored size: 543 Bytes

Contents

require_dependency 'notee/application_controller'

module Notee
  class RolesController < ApplicationController
    def index
      render json: { status: 'success', roles: User.roles }
    end

    def show
      user = find_user_by_access_token

      if user
        render json: { status: 'success', role: user.role }
      else
        render json: { status: 'failed' }
      end
    end

    private

    def find_user_by_access_token
      token = Token.find_by(access_token: session[:access_token])
      token.user
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
notee-1.1.2.4 app/controllers/notee/roles_controller.rb
notee-1.1.2.3 app/controllers/notee/roles_controller.rb
notee-1.1.2.2 app/controllers/notee/roles_controller.rb
notee-1.1.2.1 app/controllers/notee/roles_controller.rb
notee-1.1.2 app/controllers/notee/roles_controller.rb
notee-1.1.1 app/controllers/notee/roles_controller.rb
notee-1.1.0 app/controllers/notee/roles_controller.rb
notee-1.0.8 app/controllers/notee/roles_controller.rb
notee-1.0.7 app/controllers/notee/roles_controller.rb
notee-1.0.6 app/controllers/notee/roles_controller.rb
notee-1.0.5 app/controllers/notee/roles_controller.rb
notee-1.0.4 app/controllers/notee/roles_controller.rb
notee-1.0.3 app/controllers/notee/roles_controller.rb
notee-1.0.2 app/controllers/notee/roles_controller.rb
notee-1.0.1 app/controllers/notee/roles_controller.rb
notee-1.0.0 app/controllers/notee/roles_controller.rb