1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-18 02:41:15 +02:00

disabled org labeling

This commit is contained in:
Kyle Spearrin 2017-04-11 15:56:57 -04:00
parent 400932c6de
commit d619167c02
9 changed files with 76 additions and 28 deletions

View File

@ -1,7 +1,7 @@
angular
.module('bit.global')
.controller('sideNavController', function ($scope, $state, authService) {
.controller('sideNavController', function ($scope, $state, authService, toastr) {
$scope.$state = $state;
$scope.params = $state.params;
$scope.orgs = [];
@ -21,7 +21,8 @@ angular
else {
var orgs = [];
for (var orgId in userProfile.organizations) {
if (userProfile.organizations.hasOwnProperty(orgId)) {
if (userProfile.organizations.hasOwnProperty(orgId) &&
(userProfile.organizations[orgId].enabled || userProfile.organizations[orgId].type < 2)) { // 2 = User
orgs.push(userProfile.organizations[orgId]);
}
}
@ -29,7 +30,12 @@ angular
}
});
$scope.viewOrganization = function (id) {
$state.go('backend.org.dashboard', { orgId: id });
$scope.viewOrganization = function (org) {
if (org.type === 2) { // 2 = User
toastr.error('You cannot manage this organization.');
return;
}
$state.go('backend.org.dashboard', { orgId: org.id });
};
});

View File

@ -1,6 +1,15 @@
angular
.module('bit.organization')
.controller('organizationDashboardController', function ($scope) {
.controller('organizationDashboardController', function ($scope, authService, $state) {
$scope.$on('$viewContentLoaded', function () {
authService.getUserProfile().then(function (userProfile) {
if (!userProfile.organizations) {
return;
}
$scope.orgProfile = userProfile.organizations[$state.params.orgId];
});
});
});

View File

@ -5,25 +5,25 @@
</h1>
</section>
<section class="content">
<div class="callout callout-warning" ng-if="subscription && subscription.cancelled">
<h4><i class="fa fa-warning"></i> Cancelled</h4>
The subscription to this organization has been canceled.
</div>
<div class="callout callout-warning" ng-if="subscription && subscription.markedForCancel">
<h4><i class="fa fa-warning"></i> Pending Cancellation</h4>
<p>
The subscription to this organization has been marked for cancellation at the end of the
current billing period.
</p>
<button type="button" class="btn btn-default btn-flat" ng-click="reinstate()">
Reinstate Plan
</button>
</div>
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Plan</h3>
</div>
<div class="box-body">
<div class="callout callout-warning" ng-if="subscription && subscription.cancelled">
<h4><i class="fa fa-warning"></i> Cancelled</h4>
The subscription to this organization has been canceled.
</div>
<div class="callout callout-warning" ng-if="subscription && subscription.markedForCancel">
<h4><i class="fa fa-warning"></i> Pending Cancellation</h4>
<p>
The subscription to this organization has been marked for cancellation at the end of the
current billing period.
</p>
<button type="button" class="btn btn-default btn-flat" ng-click="reinstate()">
Reinstate Plan
</button>
</div>
<div class="row">
<div class="col-sm-6">
<dl>

View File

@ -5,12 +5,28 @@
</h1>
</section>
<section class="content">
<div class="callout callout-warning" ng-if="!orgProfile.enabled">
<h4><i class="fa fa-warning"></i> Organization Disabled</h4>
<p>
This organization is currently disabled. Users will not see your shared logins or subvaults.
Contact us if you would like to reinstate this organization.
</p>
<a class="btn btn-default btn-flat" href="https://bitwarden.com/contact/" target="_blank">
Contact Us
</a>
</div>
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"><i class="fa fa-server"></i> My Org</h3>
<h3 class="box-title">Let's Get Started!</h3>
</div>
<div class="box-body">
Some data
<p>Dashboard features are coming soon. Get started by inviting users and creating your subvaults!</p>
<a class="btn btn-default btn-flat" ui-sref="backend.org.people({orgId: orgProfile.id})">
Invite Users
</a>
<a class="btn btn-default btn-flat" ui-sref="backend.org.subvaults({orgId: orgProfile.id})">
Manage Subvaults
</a>
</div>
</div>
</section>

View File

@ -103,7 +103,8 @@ angular
name: profile.Organizations[i].Name,
key: profile.Organizations[i].Key,
status: profile.Organizations[i].Status,
type: profile.Organizations[i].Type
type: profile.Organizations[i].Type,
enabled: profile.Organizations[i].Enabled
};
}
@ -130,7 +131,8 @@ angular
name: org.Name,
key: key,
status: 2, // 2 = Confirmed
type: 0 // 0 = Owner
type: 0, // 0 = Owner
enabled: true
};
profile.organizations[o.id] = o;

View File

@ -32,7 +32,8 @@
id: user.Organizations[i].Id,
name: user.Organizations[i].Name,
status: user.Organizations[i].Status,
type: user.Organizations[i].Type
type: user.Organizations[i].Type,
enabled: user.Organizations[i].Enabled
});
}
@ -73,8 +74,13 @@
});
};
$scope.viewOrganization = function (id) {
$state.go('backend.org.dashboard', { orgId: id });
$scope.viewOrganization = function (org) {
if (org.type === 2) { // 2 = User
toastr.error('You cannot manage this organization.');
return;
}
$state.go('backend.org.dashboard', { orgId: org.id });
};
$scope.twoFactor = function () {

View File

@ -115,10 +115,11 @@
</div>
<div class="list-group" ng-if="model.organizations && model.organizations.length">
<a ng-repeat="org in model.organizations | orderBy: ['name']"
href="javascript:void(0)" ng-click="org.type !== 2 && viewOrganization(org.id)" class="list-group-item">
href="javascript:void(0)" ng-click="viewOrganization(org)" class="list-group-item">
<letter-avatar data="{{org.name}}" round="false" avwidth="25" avheight="25"
avclass="img-rounded" fontsize="10"></letter-avatar>
{{org.name}}
<span class="label bg-gray" ng-if="!org.enabled">DISABLED</span>
</a>
</div>
<div class="box-footer">

View File

@ -96,7 +96,7 @@
<div class="subsection">
<ul class="list-inline">
<li ng-repeat="org in orgs | orderBy: ['name']">
<a href="javascript:void(0)" ng-click="viewOrganization(org.id)">
<a href="javascript:void(0)" ng-click="viewOrganization(org)">
<letter-avatar data="{{org.name}}" avclass="img-responsive img-rounded" round="false"
avheight="40" avwidth="40" bgcolor="#1a2226"></letter-avatar>
</a>

View File

@ -258,6 +258,14 @@ form .btn .loading-icon {
}
}
.callout a.btn {
text-decoration: none;
&.btn-default {
color: @btn-default-color;
}
}
/* Boxes */
.box > .list-group {