2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2017-09-29 14:26:43 +00:00
|
|
|
class WeiboOauth2 < ActiveRecord::Migration[4.2]
|
2017-09-26 14:41:55 +00:00
|
|
|
def up
|
|
|
|
|
|
|
|
# return if it's a new setup
|
2020-08-03 08:35:43 +00:00
|
|
|
return if !Setting.exists?(name: 'system_init_done')
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2017-09-26 14:41:55 +00:00
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
title: 'Authentication via %s',
|
|
|
|
name: 'auth_weibo',
|
|
|
|
area: 'Security::ThirdPartyAuthentication',
|
2017-09-26 14:41:55 +00:00
|
|
|
description: 'Enables user authentication via %s. Register your app first at [%s](%s).',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-09-26 14:41:55 +00:00
|
|
|
form: [
|
|
|
|
{
|
|
|
|
display: '',
|
2018-12-19 17:31:51 +00:00
|
|
|
null: true,
|
|
|
|
name: 'auth_weibo',
|
|
|
|
tag: 'boolean',
|
2017-09-26 14:41:55 +00:00
|
|
|
options: {
|
|
|
|
true => 'yes',
|
|
|
|
false => 'no',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
preferences: {
|
2018-12-19 17:31:51 +00:00
|
|
|
controller: 'SettingsAreaSwitch',
|
|
|
|
sub: ['auth_weibo_credentials'],
|
|
|
|
title_i18n: ['Weibo'],
|
2017-09-26 14:41:55 +00:00
|
|
|
description_i18n: ['Weibo', 'Sina Weibo Open Portal', 'http://open.weibo.com'],
|
2018-12-19 17:31:51 +00:00
|
|
|
permission: ['admin.security'],
|
2017-09-26 14:41:55 +00:00
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: false,
|
|
|
|
frontend: true
|
2017-09-26 14:41:55 +00:00
|
|
|
)
|
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
title: 'Weibo App Credentials',
|
|
|
|
name: 'auth_weibo_credentials',
|
|
|
|
area: 'Security::ThirdPartyAuthentication::Weibo',
|
2017-09-26 14:41:55 +00:00
|
|
|
description: 'Enables user authentication via Sina Weibo.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-09-26 14:41:55 +00:00
|
|
|
form: [
|
|
|
|
{
|
|
|
|
display: 'App ID',
|
2018-12-19 17:31:51 +00:00
|
|
|
null: true,
|
|
|
|
name: 'app_id',
|
|
|
|
tag: 'input',
|
2017-09-26 14:41:55 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
display: 'App Secret',
|
2018-12-19 17:31:51 +00:00
|
|
|
null: true,
|
|
|
|
name: 'app_secret',
|
|
|
|
tag: 'input',
|
2017-09-26 14:41:55 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: {},
|
2017-09-26 14:41:55 +00:00
|
|
|
preferences: {
|
|
|
|
permission: ['admin.security'],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false
|
2017-09-26 14:41:55 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|