2020-05-13 20:07:47 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module AccessTokensHelper
|
2021-12-15 19:15:50 -05:00
|
|
|
include AccountsHelper
|
|
|
|
include ApplicationHelper
|
|
|
|
|
2020-05-13 20:07:47 -04:00
|
|
|
def scope_description(prefix)
|
|
|
|
prefix == :project_access_token ? [:doorkeeper, :project_access_token_scope_desc] : [:doorkeeper, :scope_desc]
|
|
|
|
end
|
2021-12-15 19:15:50 -05:00
|
|
|
|
|
|
|
def tokens_app_data
|
|
|
|
{
|
|
|
|
feed_token: {
|
|
|
|
enabled: !Gitlab::CurrentSettings.disable_feed_token,
|
|
|
|
token: current_user.feed_token,
|
|
|
|
reset_path: reset_feed_token_profile_path
|
|
|
|
},
|
|
|
|
incoming_email_token: {
|
|
|
|
enabled: incoming_email_token_enabled?,
|
|
|
|
token: current_user.enabled_incoming_email_token,
|
|
|
|
reset_path: reset_incoming_email_token_profile_path
|
|
|
|
},
|
|
|
|
static_object_token: {
|
|
|
|
enabled: static_objects_external_storage_enabled?,
|
|
|
|
token: current_user.enabled_static_object_token,
|
|
|
|
reset_path: reset_static_object_token_profile_path
|
|
|
|
}
|
|
|
|
}.to_json
|
|
|
|
end
|
2022-03-09 13:08:16 -05:00
|
|
|
|
|
|
|
def expires_at_field_data
|
2022-05-18 20:09:09 -04:00
|
|
|
{
|
|
|
|
min_date: 1.day.from_now.iso8601
|
|
|
|
}
|
2022-03-09 13:08:16 -05:00
|
|
|
end
|
2020-05-13 20:07:47 -04:00
|
|
|
end
|
2022-03-09 13:08:16 -05:00
|
|
|
|
|
|
|
AccessTokensHelper.prepend_mod
|