2020-05-24 23:13:21 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module AccessTokensHelper
|
2022-01-26 12:08:38 +05:30
|
|
|
include AccountsHelper
|
|
|
|
include ApplicationHelper
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
def scope_description(prefix)
|
|
|
|
prefix == :project_access_token ? [:doorkeeper, :project_access_token_scope_desc] : [:doorkeeper, :scope_desc]
|
|
|
|
end
|
2022-01-26 12:08:38 +05:30
|
|
|
|
|
|
|
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-05-07 20:08:51 +05:30
|
|
|
|
|
|
|
def expires_at_field_data
|
2022-07-23 23:45:48 +05:30
|
|
|
{
|
|
|
|
min_date: 1.day.from_now.iso8601
|
|
|
|
}
|
2022-05-07 20:08:51 +05:30
|
|
|
end
|
2020-05-24 23:13:21 +05:30
|
|
|
end
|
2022-05-07 20:08:51 +05:30
|
|
|
|
|
|
|
AccessTokensHelper.prepend_mod
|