docbrown/app/policies/github_repo_policy.rb
rhymes 81fff248dd
Refactoring GitHub Repos functionality - step 1 (#7764)
* Rename find_or_create to upsert and improve validation and testing

* Add User.authenticated_through?

* Refactor settings/integrations

* Refactor profile github repositories rendering

* Refactor repos fetching

* Only fetch a single repo and improve error messages

* Remove unused code

* Cleanups

* Fix specs

* Remove trailing whitespace

* Fix spec

* Trigger Travis
2020-05-12 13:48:19 +02:00

13 lines
285 B
Ruby

class GithubRepoPolicy < ApplicationPolicy
def index?
!user_is_banned? && user.authenticated_through?(:github)
end
def update_or_create?
!user_is_banned? && user.authenticated_through?(:github)
end
def permitted_attributes
%i[github_id_code featured]
end
end