Welcome to mirror list, hosted at ThFree Co, Russian Federation.

user_applications_presenter.rb « presenters « app - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 18855cbbbf30057e85d961075807ff4943da76ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

class UserApplicationsPresenter
  def initialize(user)
    @user = user
  end

  def user_applications
    @applications ||= @user.o_auth_applications.map do |app|
      authorization = Api::OpenidConnect::Authorization.find_by_client_id_and_user(app.client_id, @user)
      UserApplicationPresenter.new app, authorization.scopes, authorization.id
    end
  end

  def applications_count
    user_applications.size
  end

  def applications?
    applications_count > 0
  end
end