Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101669197
PhabricatorUserLDAPSettingsPanelController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 12, 15:18
Size
2 KB
Mime Type
text/x-php
Expires
Fri, Feb 14, 15:18 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24206301
Attached To
rPH Phabricator
PhabricatorUserLDAPSettingsPanelController.php
View Options
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final
class
PhabricatorUserLDAPSettingsPanelController
extends
PhabricatorUserSettingsPanelController
{
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$ldap_info
=
id
(
new
PhabricatorUserLDAPInfo
())->
loadOneWhere
(
'userID = %d'
,
$user
->
getID
());
$forms
=
array
();
if
(!
$ldap_info
)
{
$unlink
=
'Link LDAP Account'
;
$unlink_form
=
new
AphrontFormView
();
$unlink_form
->
setUser
(
$user
)
->
setAction
(
'/ldap/login/'
)
->
appendChild
(
'<p class="aphront-form-instructions">There is currently no '
.
'LDAP account linked to your Phabricator account. You can link an '
.
'account, which will allow you to use it to log into Phabricator</p>'
)
->
appendChild
(
id
(
new
AphrontFormTextControl
())
->
setLabel
(
'LDAP username'
)
->
setName
(
'username'
))
->
appendChild
(
id
(
new
AphrontFormPasswordControl
())
->
setLabel
(
'Password'
)
->
setName
(
'password'
))
->
appendChild
(
id
(
new
AphrontFormSubmitControl
())
->
setValue
(
"Link LDAP Account
\x
C2
\x
BB"
));
$forms
[
'Link Account'
]
=
$unlink_form
;
}
else
{
$unlink
=
'Unlink LDAP Account'
;
$unlink_form
=
new
AphrontFormView
();
$unlink_form
->
setUser
(
$user
)
->
appendChild
(
'<p class="aphront-form-instructions">You may unlink this account '
.
'from your LDAP account. This will prevent you from logging in with '
.
'your LDAP credentials.</p>'
)
->
appendChild
(
id
(
new
AphrontFormSubmitControl
())
->
addCancelButton
(
'/ldap/unlink/'
,
$unlink
));
$forms
[
'Unlink Account'
]
=
$unlink_form
;
}
$panel
=
new
AphrontPanelView
();
$panel
->
setHeader
(
'LDAP Account Settings'
);
$panel
->
setWidth
(
AphrontPanelView
::
WIDTH_FORM
);
foreach
(
$forms
as
$name
=>
$form
)
{
if
(
$name
)
{
$panel
->
appendChild
(
'<br /><h1>'
.
$name
.
'</h1><br />'
);
}
$panel
->
appendChild
(
$form
);
}
return
id
(
new
AphrontNullView
())
->
appendChild
(
array
(
$panel
,
));
}
}
Event Timeline
Log In to Comment