-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
5,509 additions
and
617 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -418,7 +418,7 @@ claims_api: | |
services: | ||
lighthouse: | ||
api_key: fake-xxxxxx-zzzz-aaaa-bbbb-cccccccc-xxxxxx-zzzz-aaaa-bbbb-cccccccc | ||
|
||
ask_va: | ||
crm_api: | ||
auth_url: https://login.microsoftonline.us | ||
|
@@ -449,3 +449,7 @@ travel_pay: | |
va_notify: | ||
status_callback: | ||
bearer_token: 'va_notify_bearer_token' | ||
|
||
accredited_representative_portal: | ||
pilot_user_email_poa_codes: | ||
'[email protected]': ['123'] |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...representative_portal/app/policies/accredited_representative_portal/application_policy.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# frozen_string_literal: true | ||
|
||
module AccreditedRepresentativePortal | ||
class ApplicationPolicy | ||
attr_reader :user, :record | ||
|
||
def initialize(user, record) | ||
@user = user | ||
@record = record | ||
end | ||
|
||
def index? | ||
override_warning | ||
false | ||
end | ||
|
||
def show? | ||
override_warning | ||
false | ||
end | ||
|
||
def create? | ||
override_warning | ||
false | ||
end | ||
|
||
def new? | ||
create? | ||
end | ||
|
||
def update? | ||
override_warning | ||
false | ||
end | ||
|
||
def edit? | ||
update? | ||
end | ||
|
||
def destroy? | ||
override_warning | ||
false | ||
end | ||
|
||
private | ||
|
||
def override_warning | ||
Rails.logger.warn( | ||
"#{self.class} is using the default ##{caller_locations(1, 1)[0].label} implementation. \ | ||
Consider overriding it." | ||
) | ||
end | ||
|
||
class Scope | ||
def initialize(user, scope) | ||
@user = user | ||
@scope = scope | ||
end | ||
|
||
def resolve | ||
raise NoMethodError, "You must define #resolve in #{self.class}" | ||
end | ||
|
||
private | ||
|
||
attr_reader :user, :scope | ||
end | ||
end | ||
end |
31 changes: 31 additions & 0 deletions
31
...portal/app/policies/accredited_representative_portal/power_of_attorney_requests_policy.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
module AccreditedRepresentativePortal | ||
class PowerOfAttorneyRequestsPolicy < ApplicationPolicy | ||
def index? | ||
authorize | ||
end | ||
|
||
def show? | ||
authorize | ||
end | ||
|
||
private | ||
|
||
def pilot_user_email_poa_codes | ||
Settings | ||
.accredited_representative_portal | ||
.pilot_user_email_poa_codes.to_h | ||
.stringify_keys! | ||
end | ||
|
||
def authorize | ||
return false unless @user | ||
|
||
pilot_user_poa_codes = Set.new(pilot_user_email_poa_codes[@user&.email]) | ||
poa_requests_poa_codes = Set.new(Array.wrap(@record), &:poa_code) | ||
|
||
pilot_user_poa_codes >= poa_requests_poa_codes | ||
end | ||
end | ||
end |
Oops, something went wrong.