mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-28 17:27:50 +01:00
org events page setup
This commit is contained in:
parent
4ecf307285
commit
90c079e743
2
dist/.publish
vendored
2
dist/.publish
vendored
@ -1 +1 @@
|
||||
Subproject commit 466ddf04c4878942e2901a7330d6de3b2971c204
|
||||
Subproject commit 7bdd5f9735d6f0f39f147286fb03eb33877aa4e1
|
@ -224,6 +224,12 @@ angular
|
||||
controller: 'organizationGroupsController',
|
||||
data: { pageTitle: 'Organization Groups' }
|
||||
})
|
||||
.state('backend.org.events', {
|
||||
url: '/organization/:orgId/events',
|
||||
templateUrl: 'app/organization/views/organizationEvents.html',
|
||||
controller: 'organizationEventsController',
|
||||
data: { pageTitle: 'Organization Events' }
|
||||
})
|
||||
|
||||
// Frontend
|
||||
.state('frontend', {
|
||||
|
@ -39,6 +39,39 @@ angular.module('bit')
|
||||
hidden: 1,
|
||||
boolean: 2
|
||||
},
|
||||
eventType: {
|
||||
User_LoggedIn: 1000,
|
||||
User_ChangedPassword: 1001,
|
||||
User_Enabled2fa: 1002,
|
||||
User_Disabled2fa: 1003,
|
||||
User_Recovered2fa: 1004,
|
||||
User_FailedLogIn: 1005,
|
||||
User_FailedLogIn2fa: 1006,
|
||||
|
||||
Cipher_Created: 1100,
|
||||
Cipher_Updated: 1101,
|
||||
Cipher_Deleted: 1102,
|
||||
Cipher_AttachmentCreated: 1103,
|
||||
Cipher_AttachmentDeleted: 1104,
|
||||
Cipher_Shared: 1105,
|
||||
Cipher_UpdatedCollections: 1106,
|
||||
|
||||
Collection_Created: 1300,
|
||||
Collection_Updated: 1301,
|
||||
Collection_Deleted: 1302,
|
||||
|
||||
Group_Created: 1400,
|
||||
Group_Updated: 1401,
|
||||
Group_Deleted: 1402,
|
||||
|
||||
OrganizationUser_Invited: 1500,
|
||||
OrganizationUser_Confirmed: 1501,
|
||||
OrganizationUser_Updated: 1502,
|
||||
OrganizationUser_Removed: 1503,
|
||||
OrganizationUser_UpdatedGroups: 1504,
|
||||
|
||||
Organization_Updated: 1600
|
||||
},
|
||||
twoFactorProviderInfo: [
|
||||
{
|
||||
type: 0,
|
||||
|
148
src/app/organization/organizationEventsController.js
Normal file
148
src/app/organization/organizationEventsController.js
Normal file
@ -0,0 +1,148 @@
|
||||
angular
|
||||
.module('bit.organization')
|
||||
|
||||
.controller('organizationEventsController', function ($scope, $state, apiService, $uibModal, $filter,
|
||||
toastr, $analytics, constants) {
|
||||
$scope.events = [];
|
||||
$scope.orgUsers = [];
|
||||
$scope.loading = true;
|
||||
$scope.$on('$viewContentLoaded', function () {
|
||||
load();
|
||||
});
|
||||
|
||||
var i = 0,
|
||||
orgUsersUserIdDict = {},
|
||||
orgUsersIdDict = {};
|
||||
|
||||
function load() {
|
||||
apiService.organizationUsers.list({ orgId: $state.params.orgId }).$promise.then(function (list) {
|
||||
var users = [];
|
||||
for (i = 0; i < list.Data.length; i++) {
|
||||
var user = {
|
||||
id: list.Data[i].Id,
|
||||
userId: list.Data[i].UserId,
|
||||
name: list.Data[i].Name,
|
||||
email: list.Data[i].Email
|
||||
};
|
||||
|
||||
users.push(user);
|
||||
|
||||
var displayName = user.name || user.email;
|
||||
orgUsersUserIdDict[user.userId] = displayName;
|
||||
orgUsersIdDict[user.id] = displayName;
|
||||
}
|
||||
|
||||
$scope.orgUsers = users;
|
||||
return apiService.events.listOrganization({ orgId: $state.params.orgId }).$promise;
|
||||
}).then(function (list) {
|
||||
var events = [];
|
||||
for (i = 0; i < list.Data.length; i++) {
|
||||
var userId = list.Data[i].ActingUserId || list.Data[i].UserId;
|
||||
events.push({
|
||||
message: eventMessage(list.Data[i]),
|
||||
appIcon: 'fa-globe',
|
||||
appName: 'Web',
|
||||
userId: userId,
|
||||
userName: userId ? (orgUsersUserIdDict[userId] || '-') : '-',
|
||||
date: list.Data[i].Date
|
||||
});
|
||||
}
|
||||
$scope.events = events;
|
||||
$scope.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
function eventMessage(ev) {
|
||||
var msg = '';
|
||||
switch (ev.Type) {
|
||||
// User
|
||||
case constants.eventType.User_LoggedIn:
|
||||
msg = 'Logged in.';
|
||||
break;
|
||||
case constants.eventType.User_ChangedPassword:
|
||||
msg = 'Changed account password.';
|
||||
break;
|
||||
case constants.eventType.User_Enabled2fa:
|
||||
msg = 'Enabled two-step login.';
|
||||
break;
|
||||
case constants.eventType.User_Disabled2fa:
|
||||
msg = 'Disabled two-step login.';
|
||||
break;
|
||||
case constants.eventType.User_Recovered2fa:
|
||||
msg = 'Recovered account from two-step login.';
|
||||
break;
|
||||
case constants.eventType.User_FailedLogIn:
|
||||
msg = 'Login attempt failed with incorrect password.';
|
||||
break;
|
||||
case constants.eventType.User_FailedLogIn2fa:
|
||||
msg = 'Login attempt failed with incorrect two-step login.';
|
||||
break;
|
||||
// Cipher
|
||||
case constants.eventType.Cipher_Created:
|
||||
msg = 'Created item ' + ev.CipherId + '.';
|
||||
break;
|
||||
case constants.eventType.Cipher_Updated:
|
||||
msg = 'Edited item ' + ev.CipherId + '.';
|
||||
break;
|
||||
case constants.eventType.Cipher_Deleted:
|
||||
msg = 'Deleted item ' + ev.CipherId + '.';
|
||||
break;
|
||||
case constants.eventType.Cipher_AttachmentCreated:
|
||||
msg = 'Created attachment for item ' + ev.CipherId + '.';
|
||||
break;
|
||||
case constants.eventType.Cipher_AttachmentDeleted:
|
||||
msg = 'Deleted attachment for item ' + ev.CipherId + '.';
|
||||
break;
|
||||
case constants.eventType.Cipher_Shared:
|
||||
msg = 'Shared item ' + ev.CipherId + '.';
|
||||
break;
|
||||
case constants.eventType.Cipher_UpdatedCollections:
|
||||
msg = 'Update collections for item ' + ev.CipherId + '.';
|
||||
break;
|
||||
// Collection
|
||||
case constants.eventType.Collection_Created:
|
||||
msg = 'Created collection ' + ev.CollectionId + '.';
|
||||
break;
|
||||
case constants.eventType.Collection_Updated:
|
||||
msg = 'Edited collection ' + ev.CollectionId + '.';
|
||||
break;
|
||||
case constants.eventType.Collection_Deleted:
|
||||
msg = 'Deleted collection ' + ev.CollectionId + '.';
|
||||
break;
|
||||
// Group
|
||||
case constants.eventType.Group_Created:
|
||||
msg = 'Created group ' + ev.GroupId + '.';
|
||||
break;
|
||||
case constants.eventType.Group_Updated:
|
||||
msg = 'Edited group ' + ev.GroupId + '.';
|
||||
break;
|
||||
case constants.eventType.Group_Deleted:
|
||||
msg = 'Deleted group ' + ev.GroupId + '.';
|
||||
break;
|
||||
// Org user
|
||||
case constants.eventType.OrganizationUser_Invited:
|
||||
msg = 'Invited user ' + ev.OrganizationUserId + '.';
|
||||
break;
|
||||
case constants.eventType.OrganizationUser_Confirmed:
|
||||
msg = 'Confirmed user ' + ev.OrganizationUserId + '.';
|
||||
break;
|
||||
case constants.eventType.OrganizationUser_Updated:
|
||||
msg = 'Edited user ' + ev.OrganizationUserId + '.';
|
||||
break;
|
||||
case constants.eventType.OrganizationUser_Removed:
|
||||
msg = 'Removed user ' + ev.OrganizationUserId + '.';
|
||||
break;
|
||||
case constants.eventType.OrganizationUser_UpdatedGroups:
|
||||
msg = 'Edited groups for user ' + ev.OrganizationUserId + '.';
|
||||
break;
|
||||
// Org
|
||||
case constants.eventType.Organization_Updated:
|
||||
msg = 'Edited organization settings.';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return msg === '' ? null : msg;
|
||||
}
|
||||
});
|
52
src/app/organization/views/organizationEvents.html
Normal file
52
src/app/organization/views/organizationEvents.html
Normal file
@ -0,0 +1,52 @@
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
Events
|
||||
<small>audit your organization</small>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
|
||||
<div class="box-filters hidden-xs">
|
||||
Filters
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body" ng-class="{'no-padding': filteredEvents.length}">
|
||||
<div ng-show="loading && !events.length">
|
||||
Loading...
|
||||
</div>
|
||||
<div ng-show="!loading && !events.length">
|
||||
<p>There are no events yet for your organization.</p>
|
||||
</div>
|
||||
<div class="table-responsive" ng-show="events.length">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Timestamp</th>
|
||||
<th>User</th>
|
||||
<th>App</th>
|
||||
<th>Event</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="event in filteredEvents = (events | orderBy: ['-date'])">
|
||||
<td style="width: 210px; min-width: 100px;">
|
||||
{{event.date | date:'medium'}}
|
||||
</td>
|
||||
<td style="width: 150px; min-width: 100px;">
|
||||
{{event.userName}}
|
||||
</td>
|
||||
<td style="width: 20px;" class="text-center">
|
||||
<i class="text-muted fa fa-lg {{event.appIcon}}" title="{{event.appName}}"></i>
|
||||
</td>
|
||||
<td>
|
||||
{{event.message}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
@ -179,6 +179,11 @@
|
||||
getPublicKey: { url: _apiUri + '/users/:id/public-key', method: 'GET', params: { id: '@id' } }
|
||||
});
|
||||
|
||||
_service.events = $resource(_apiUri + '/events', {}, {
|
||||
list: { method: 'GET', params: {} },
|
||||
listOrganization: { url: _apiUri + '/organizations/:orgId/events', method: 'GET', params: { id: '@orgId' } }
|
||||
});
|
||||
|
||||
_service.identity = $resource(_identityUri + '/connect', {}, {
|
||||
token: {
|
||||
url: _identityUri + '/connect/token',
|
||||
|
@ -95,6 +95,11 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li ng-class="{active: $state.is('backend.org.events')}" ng-if="orgProfile.useGroups">
|
||||
<a ui-sref="backend.org.events({orgId: params.orgId})">
|
||||
<i class="fa fa-sitemap fa-fw"></i> <span>Events</span>
|
||||
</a>
|
||||
</li>
|
||||
<li ng-class="{active: $state.is('backend.org.billing')}" ng-if="isOrgOwner(orgProfile)">
|
||||
<a ui-sref="backend.org.billing({orgId: params.orgId})">
|
||||
<i class="fa fa-credit-card fa-fw"></i> Billing & Licensing
|
||||
|
@ -257,6 +257,7 @@
|
||||
<script src="app/organization/organizationGroupsAddController.js"></script>
|
||||
<script src="app/organization/organizationGroupsEditController.js"></script>
|
||||
<script src="app/organization/organizationGroupsUsersController.js"></script>
|
||||
<script src="app/organization/organizationEventsController.js"></script>
|
||||
|
||||
<script src="app/settings/settingsModule.js"></script>
|
||||
<script src="app/settings/settingsController.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user