Skip to content
This repository was archived by the owner on Sep 17, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
part of security_monkey;

@Component(
selector: 'justified-table',
templateUrl: 'packages/security_monkey/component/justified_table_component/justified_table_component.html',
useShadowDom: false
)
class JustifiedTableComponent extends PaginatedTable implements ScopeAware {
List<Issue> issues = [];
RouteProvider routeProvider;
Router router;
ObjectStore store;
bool constructor_complete = false;
Scope _scope;

Map<String, String> filter_params = {
'regions': '',
'technologies': '',
'accounts': '',
'names': '',
'arns': '',
'active': null,
'searchconfig': null,
'page': '1',
'count': '25',
'enabledonly': 'true',
'justified': true
};

JustifiedTableComponent(this.routeProvider, this.router, this.store) {
filter_params = map_from_url(filter_params, this.routeProvider);

/// The AngularUI Pagination tries to correct the currentPage value
/// to page 1 when the API server hasn't yet responded with results.
/// To fix, don't set the currentPage variable until we have received
/// a response from the API server containing totalItems.
store.list(Issue, params: filter_params).then((issues) {
super.setPaginationData(issues.meta);
this.issues = issues;
super.is_loaded = true;
super.items_per_page = filter_params['count'];
super.currentPage = int.parse(filter_params['page']);
constructor_complete = true;
});
}

void list() {
if (!constructor_complete) {
return;
}
if (filter_params['page'] != super.currentPage.toString() || filter_params['count'] != super.items_per_page) {
filter_params['page'] = super.currentPage.toString();
filter_params['count'] = super.items_per_page;
this.pushFilterRoutes();
} else {
print("Loading Filtered Data.");
store.list(Issue, params: filter_params).then((issues) {
super.setPaginationData(justifiled_issues.meta);
this.issues = issues;
super.is_loaded = true;
});
}
}

void pushFilterRoutes() {
filter_params = map_to_url(filter_params);
print("Pushing justified_table_component filter routes: $filter_params");
router.go('justified', filter_params);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<div class="panel panel-info">
<div class="panel-heading">Justified Issues Report
<!-- <span class="badge pull-right">{{ items_displayed() }} of {{ totalItems }}</span> -->
<button type="button" class="btn btn-default btn-xs pull-right disabled">
<span class="pull-right">{{ items_displayed() }} of {{ totalItems }}</span>
</button>
</div>
<div class="panel-body" ng-switch="is_loaded">
<div ng-switch-when="false" ng-switch="is_error">
<div ng-switch-when="false">
<p>Loading . . .</p>
</div>
<div ng-switch-when="true">
<div class="alert alert-danger">
{{err_message}}
</div>
</div>
</div>
<table class="table table-striped" ng-switch-when="true">
<thead>
<tr>
<th>Item Name</th>
<th>Technology</th>
<th>Account</th>
<th>Region</th>
<th>Issue</th>
<th>Notes</th>
<th>Score</th>
<th>Justification</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="issue in issues" class="success">
<td><a href="#/viewitem/{{issue.item_id}}">{{issue.item.name}}</a></td>
<td>{{issue.item.technology}}</td>
<td>{{issue.item.account}}</td>
<td>{{issue.item.region}}</td>
<td>{{issue.issue}}</td>
<td>{{issue.notes}}</td>
<td>{{issue.score}}</td>
<td><b>{{issue.justified_user}}</b><br />{{issue.justification}}</td>
</tr>
</tbody>
</table>
</div>
<div class="panel-footer">
<div class="row">
<div class="col-lg-9">
<pagination
items-per-page="ipp_as_int"
total-items="totalItems"
page="currentPage"
on-select-page="pageChanged()"
max-size="maxSize"
boundary-links="true">
</pagination>
</div>
<div class="col-lg-3 pull-right">
<br/> <!-- Why do I need a br-tag to get the dropdown to line up properly? -->
<select ng-model="items_per_page" class="form-control">
<option
ng-repeat="page in items_per_page_options"
value="{{page}}">{{page}}</option>
</select>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ <h6>Type</h6>
<option value="items">Items</option>
<option value="revisions">Items + Historical Changes</option>
<option value="issues">Audit Issues</option>
<option value="justified">Justified Issues</option>
</select>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<revision-table ng-switch-when="revisions"></revision-table>
<item-table ng-switch-when="items"></item-table>
<issue-table ng-switch-when="issues"></issue-table>
<justified-table ng-switch-when="justified"></justified-table>
<h1 ng-switch-when="null">Enter a search on the left.</h1>
</div> <!-- end right-sidebar -->
</div>
10 changes: 10 additions & 0 deletions dart/lib/routing/securitymonkey_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ void securityMonkeyRouteInitializer(Router router, RouteViewFactory views) {
defaultRoute: true,
view: 'views/error.html')
}),
'justified': ngRoute(
path: '/justified/:regions/:technologies/:accounts/:accounttypes/:names/:arns/:active/:searchconfig/:page/:count',
mount: {
'view': ngRoute(
path: '',
view: 'views/searchpage.html'),
'view_default': ngRoute(
defaultRoute: true,
view: 'views/error.html')
}),
'viewitemrevision': ngRoute(
path: '/viewitem/:itemid/:revid',
view: 'views/itemdetailsview.html'
Expand Down
2 changes: 2 additions & 0 deletions dart/lib/security_monkey.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ part 'component/dashboard_component/dashboard_component.dart';
part 'component/settings/user_role_component/user_role_component.dart';
part 'component/settings/network_whitelist_component/network_whitelist_component.dart';
part 'component/settings/ignore_list_component/ignore_list_component.dart';
part 'component/justified_table_component/justified_table_component.dart';
part 'component/auditscore_view_component/auditscore_view_component.dart';
part 'component/account_pattern_audit_score_view_component/account_pattern_audit_score_view_component.dart';
part 'component/settings/audit_score_component/audit_score_component.dart';
Expand Down Expand Up @@ -119,6 +120,7 @@ class SecurityMonkeyModule extends Module {
bind(UserRoleComponent);
bind(NetworkWhitelistComponent);
bind(IgnoreListComponent);
bind(JustifiedTableComponent);
bind(AuditScoreComponent);
bind(AccountPatternAuditScoreComponent);
bind(AuditScoreListComponent);
Expand Down
2 changes: 2 additions & 0 deletions dart/web/ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
<li><a href="#/issues/-/iamgroup/-/-/-/-/True/-/1/25">IAM Group Issues</a></li>
<li><a href="#/issues/-/policy/-/-/-/-/True/-/1/25">Managed Policy Issues</a></li>
<li><a href="#/issues/-/redshift/-/-/-/-/True/-/1/25">Redshift Issues</a></li>
<li class="divider"></li>
<li><a href="#/justified/-/-/-/-/-/-/-/-/1/25">Justified Issues</a></li>
</ul>
</li>
<li><a href="#/settings">Settings</a></li>
Expand Down