check status and types for org management

This commit is contained in:
Kyle Spearrin 2017-03-25 21:52:27 -04:00
parent 3c83741b13
commit 77ddc83a04
4 changed files with 21 additions and 10 deletions

View File

@ -99,7 +99,8 @@ angular
id: profile.Organizations[i].Id, id: profile.Organizations[i].Id,
name: profile.Organizations[i].Name, name: profile.Organizations[i].Name,
key: profile.Organizations[i].Key, key: profile.Organizations[i].Key,
status: profile.Organizations[i].Status status: profile.Organizations[i].Status,
type: profile.Organizations[i].Type
}); });
} }
@ -125,12 +126,13 @@ angular
id: org.Id, id: org.Id,
name: org.Name, name: org.Name,
key: org.Key, key: org.Key,
status: org.Status status: 2, // 2 = Confirmed
type: 0 // 0 = Owner
}; };
profile.organizations.push(o); profile.organizations.push(o);
_userProfile = profile; _userProfile = profile;
cryptoService.addOrgKey(o); cryptoService.addOrgKey(o.id, o.key);
} }
}); });
}; };

View File

@ -53,7 +53,7 @@ angular
} }
}; };
_service.addOrgKey = function (orgKeyCt, privateKey) { _service.addOrgKey = function (orgId, orgKey, privateKey) {
_orgKeys = _service.getOrgKeys(); _orgKeys = _service.getOrgKeys();
if (!_orgKeys) { if (!_orgKeys) {
_orgKeys = {}; _orgKeys = {};
@ -65,9 +65,9 @@ angular
} }
try { try {
var orgKey = _service.rsaDecrypt(orgKeyCt.key, privateKey); var orgKey = _service.rsaDecrypt(orgKey, privateKey);
_orgKeys[orgKeyCt.id] = orgKey; _orgKeys[orgId] = orgKey;
orgKeysb64[orgKeyCt.id] = forge.util.encode64(orgKey); orgKeysb64[orgId] = forge.util.encode64(orgKey);
} }
catch (e) { catch (e) {
_orgKeys = null; _orgKeys = null;

View File

@ -23,9 +23,16 @@
if (user.Organizations) { if (user.Organizations) {
var orgs = []; var orgs = [];
for (var i = 0; i < user.Organizations.length; i++) { for (var i = 0; i < user.Organizations.length; i++) {
// Only confirmed
if (user.Organizations[i].Status !== 2) {
continue;
}
orgs.push({ orgs.push({
id: user.Organizations[i].Id, id: user.Organizations[i].Id,
name: user.Organizations[i].Name name: user.Organizations[i].Name,
status: user.Organizations[i].Status,
type: user.Organizations[i].Type
}); });
} }

View File

@ -118,8 +118,10 @@
</div> </div>
<div class="list-group" ng-if="model.organizations && model.organizations.length"> <div class="list-group" ng-if="model.organizations && model.organizations.length">
<a ng-repeat="org in model.organizations | orderBy: ['name']" <a ng-repeat="org in model.organizations | orderBy: ['name']"
href="javascript:void(0)" ng-click="viewOrganization(org.id)" class="list-group-item"> href="javascript:void(0)" ng-click="org.type !== 2 && viewOrganization(org.id)" class="list-group-item">
<i class="fa fa-sitemap fa-fw"></i> {{org.name}} <i class="fa fa-sitemap"></i>
{{org.name}}
<i class="fa fa-certificate" ng-show="org.type !== 2"></i>
</a> </a>
</div> </div>
<div class="box-footer"> <div class="box-footer">