Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
agallavardin
fusiondirectory-plugins
Commits
a50b2a5d
Commit
a50b2a5d
authored
May 28, 2015
by
Côme Bernigaud
Committed by
Benoit Mortier
May 28, 2015
Browse files
Fixes #3706 Parsing information about certificates
parent
d3e6ced7
Changes
1
Hide whitespace changes
Inline
Side-by-side
certificates/personal/certificates/class_userCertificates.inc
View file @
a50b2a5d
...
...
@@ -18,6 +18,37 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class
CertificateFileAttribute
extends
FileAttribute
{
/* Return the value as an array of values to be displayed in a table columns */
function
getArrayValue
()
{
$value
=
$this
->
getValue
();
$infos
=
openssl_x509_parse
(
$value
,
TRUE
);
if
(
empty
(
$infos
))
{
return
array
(
_
(
'Unknown format'
),
$this
->
displayValue
(
$this
->
getValue
()),
''
);
}
$values
=
array
(
''
,
''
,
''
);
if
(
isset
(
$infos
[
'subject'
][
'CN'
]))
{
$values
[
0
]
=
$infos
[
'subject'
][
'CN'
];
}
if
(
isset
(
$infos
[
'issuer'
][
'CN'
]))
{
$values
[
1
]
=
$infos
[
'issuer'
][
'CN'
];
}
if
(
isset
(
$infos
[
'validFrom_time_t'
]))
{
$values
[
2
]
=
date
(
'Y-m-d'
,
$infos
[
'validFrom_time_t'
])
.
' -> '
;
}
else
{
$values
[
2
]
=
'? -> '
;
}
if
(
isset
(
$infos
[
'validTo_time_t'
]))
{
$values
[
2
]
.
=
date
(
'Y-m-d'
,
$infos
[
'validTo_time_t'
]);
}
else
{
$values
[
2
]
.
=
'?'
;
}
return
$values
;
}
}
class
userCertificates
extends
simplePlugin
{
var
$displayHeader
=
TRUE
;
...
...
@@ -44,7 +75,7 @@ class userCertificates extends simplePlugin
'name'
=>
_
(
'Certificates'
),
'attrs'
=>
array
(
new
OrderedArrayAttribute
(
new
FileAttribute
(
new
Certificate
FileAttribute
(
''
,
_
(
'Certificate content'
),
'userCertificate;binary'
,
TRUE
),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment