-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into clean_up_explicit_compliance_master
- Loading branch information
Showing
29 changed files
with
1,335 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* Copyright (C) 2019 Greenbone Networks GmbH | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
import registerCommand from '../command'; | ||
|
||
import TlsCertificate from '../models/tlscertificate'; | ||
|
||
import EntitiesCommand from './entities'; | ||
import EntityCommand from './entity'; | ||
|
||
class TlsCertificateCommand extends EntityCommand { | ||
constructor(http) { | ||
super(http, 'tls_certificate', TlsCertificate); | ||
} | ||
|
||
getElementFromRoot(root) { | ||
return root.get_tls_certificate.get_tls_certificates_response | ||
.tls_certificate; | ||
} | ||
} | ||
|
||
class TlsCertificatesCommand extends EntitiesCommand { | ||
constructor(http) { | ||
super(http, 'tls_certificate', TlsCertificate); | ||
} | ||
|
||
getTimeStatusAggregates({filter} = {}) { | ||
return this.getAggregates({ | ||
aggregate_type: 'tls_certificate', | ||
group_column: 'time_status', | ||
filter, | ||
}); | ||
} | ||
|
||
getModifiedAggregates({filter} = {}) { | ||
return this.getAggregates({ | ||
aggregate_type: 'tls_certificate', | ||
group_column: 'modified', | ||
filter, | ||
}); | ||
} | ||
getEntitiesResponse(root) { | ||
return root.get_tls_certificates.get_tls_certificates_response; | ||
} | ||
} | ||
|
||
registerCommand('tlscertificate', TlsCertificateCommand); | ||
registerCommand('tlscertificates', TlsCertificatesCommand); | ||
|
||
// vim: set ts=2 sw=2 tw=80: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* Copyright (C) 2019 Greenbone Networks GmbH | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
import {_l} from 'gmp/locale/lang'; | ||
|
||
import Model from '../model'; | ||
|
||
import {parseBoolean, parseDate} from 'gmp/parser'; | ||
import {forEach} from 'gmp/utils/array'; | ||
import {isDefined} from 'gmp/utils/identity'; | ||
|
||
export const TIME_STATUS = { | ||
inactive: 'inactive', | ||
valid: 'valid', | ||
expired: 'expired', | ||
unknown: 'unknown', | ||
}; | ||
|
||
export const TIME_STATUS_TRANSLATIONS = { | ||
[TIME_STATUS.expired]: _l('Expired'), | ||
[TIME_STATUS.inactive]: _l('Inactive'), | ||
[TIME_STATUS.unknown]: _l('Unknown'), | ||
[TIME_STATUS.valid]: _l('Valid'), | ||
}; | ||
|
||
export const getTranslatableTimeStatus = status => | ||
`${TIME_STATUS_TRANSLATIONS[status]}`; | ||
|
||
class TlsCertificate extends Model { | ||
static entityType = 'tlscertificate'; | ||
|
||
parseProperties(elem) { | ||
const ret = super.parseProperties(elem); | ||
|
||
ret.issuerDn = elem.issuer_dn; | ||
delete ret.issuer_dn; | ||
|
||
ret.activationTime = parseDate(elem.activation_time); | ||
delete ret.activation_time; | ||
|
||
ret.expirationTime = parseDate(elem.expiration_time); | ||
delete ret.expiration_time; | ||
|
||
ret.lastCollected = parseDate(elem.last_collected); | ||
delete ret.last_collected; | ||
|
||
ret.timeStatus = elem.time_status; | ||
delete ret.time_status; | ||
|
||
const sourceReportIds = new Set(); | ||
const sourceHostIps = new Set(); | ||
const sourcePorts = new Set(); | ||
|
||
if (isDefined(ret.sources)) { | ||
forEach(ret.sources.source, source => { | ||
if (isDefined(source.origin)) { | ||
if (source.origin.origin_type === 'Report') { | ||
sourceReportIds.add(source.origin.origin_id); | ||
} | ||
} | ||
if (isDefined(source.location)) { | ||
if (isDefined(source.location.host)) { | ||
sourceHostIps.add(source.location.host.ip); | ||
} | ||
if (isDefined(source.location.port)) { | ||
sourcePorts.add(source.location.port); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
ret.sourceReportIds = [...sourceReportIds]; | ||
ret.sourceHostIps = [...sourceHostIps]; | ||
ret.sourcePorts = [...sourcePorts]; | ||
|
||
delete ret.sources; | ||
|
||
ret.valid = parseBoolean(elem.valid); | ||
ret.trust = parseBoolean(elem.trust); | ||
|
||
return ret; | ||
} | ||
} | ||
|
||
export default TlsCertificate; | ||
|
||
// vim: set ts=2 sw=2 tw=80: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
gsa/src/web/components/icon/__tests__/__snapshots__/tlscertificateicon.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`TlsCertificateIcon component tests should render 1`] = ` | ||
.c0 { | ||
height: 16px; | ||
width: 16px; | ||
line-height: 16px; | ||
} | ||
.c0 * { | ||
height: inherit; | ||
width: inherit; | ||
} | ||
<span | ||
class="c0 " | ||
data-testid="svg-icon" | ||
> | ||
<svg> | ||
tlscertificate.svg | ||
</svg> | ||
</span> | ||
`; |
28 changes: 28 additions & 0 deletions
28
gsa/src/web/components/icon/__tests__/tlscertificateicon.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* Copyright (C) 2019 Greenbone Networks GmbH | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
import {testIcon} from 'web/components/icon/testing'; | ||
|
||
import TlsCertificateIcon from '../tlscertificateicon'; | ||
|
||
describe('TlsCertificateIcon component tests', () => { | ||
testIcon(TlsCertificateIcon); | ||
}); | ||
|
||
// vim: set ts=2 sw=2 tw=80: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.