Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F877698
syncProviders.php
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
epriestley
Oct 14 2015, 4:56 PM
2015-10-14 16:56:47 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
syncProviders.php
View Options
...
private
function
syncProviders
(
$instance
)
{
$viewer
=
$this
->
getViewer
();
$instance_name
=
PhabricatorEnv
::
getEnvConfig
(
'cluster.instance'
);
$configs
=
id
(
new
PhabricatorAuthProviderConfigQuery
())
->
setViewer
(
$viewer
)
->
execute
();
if
(!
$configs
)
{
$config
=
id
(
new
PhabricatorAuthProviderConfig
())
->
setProviderClass
(
'PhabricatorPhabricatorAuthProvider'
)
->
setProviderType
(
'phabricator'
)
->
setProviderDomain
(
'self'
);
}
else
if
(
count
(
$configs
)
>
1
)
{
throw
new
Exception
(
pht
(
'This instance ("%s") has more than one authentication provider.'
,
$instance_name
));
}
else
{
$config
=
head
(
$configs
);
if
(
$config
->
getProviderClass
()
!=
'PhabricatorPhabricatorAuthProvider'
)
{
throw
new
Exception
(
pht
(
'This instance ("%s") has the wrong class of authentication '
.
'provider ("%s").'
,
$instance_name
,
$config
->
getProviderClass
()));
}
}
$config
->
setIsEnabled
(
1
)
->
setShouldAllowLogin
(
1
)
->
setShouldAllowRegistration
(
1
)
->
setShouldAllowLink
(
0
)
->
setShouldAllowUnlink
(
0
)
->
setShouldTrustEmails
(
1
)
->
setShouldAutoLogin
(
1
)
->
setProperties
(
array
(
PhabricatorPhabricatorAuthProvider
::
PROPERTY_PHABRICATOR_NAME
=>
'phacility'
,
PhabricatorPhabricatorAuthProvider
::
PROPERTY_PHABRICATOR_URI
=>
PhacilityServices
::
getAdminURI
(),
PhabricatorOAuth2AuthProvider
::
PROPERTY_APP_ID
=>
$instance
[
'oauth'
][
'id'
],
PhabricatorOAuth2AuthProvider
::
PROPERTY_APP_SECRET
=>
$instance
[
'oauth'
][
'secret'
],
))
->
save
();
}
...
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/xh/cz/5bkr6qpllmv6zd55
Default Alt Text
syncProviders.php (1 KB)
Attached To
Mode
P1865 syncProviders.php
Attached
Detach File
Event Timeline
Log In to Comment