Frontend loads sharing acl

This commit is contained in:
brantje 2016-10-04 15:08:24 +02:00
parent 99c7f4d4c2
commit 8c90599c34
No known key found for this signature in database
GPG key ID: 5FF1D117F918687F
2 changed files with 29 additions and 5 deletions

View file

@ -9,8 +9,8 @@
* This file is part of passman, licensed under AGPLv3
*/
angular.module('passmanApp')
.controller('ShareCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', 'NotificationService', 'SharingACL',
function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService, NotificationService, SharingACL) {
.controller('ShareCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', 'NotificationService', 'SharingACL','EncryptService',
function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService, NotificationService, SharingACL, EncryptService) {
$scope.active_vault = VaultService.getActiveVault();
$scope.tabs = [{
@ -90,8 +90,32 @@ angular.module('passmanApp')
ShareService.getSharedCredentialACL($scope.storedCredential).then(function (aclList) {
console.log(aclList);
})
var enc_key = EncryptService.decryptString(angular.copy($scope.storedCredential.shared_key));
for(var i = 0; i < aclList.length; i++){
var acl = aclList[i];
if(acl.user_id === null){
$scope.share_settings.linkSharing ={
enabled: true,
settings: {
expire_time: new Date(acl.expire * 1000),
expire_views: acl.expire_views,
acl: new SharingACL(acl.permissions)
}
};
var hash = window.btoa($scope.storedCredential.guid + '<::>'+ enc_key)
$scope.share_link = $location.$$protocol + '://' + $location.$$host + OC.generateUrl('apps/passman/share/public#') + hash;
} else {
var obj = {
userId: acl.user_id,
displayName: acl.user_id,
type: 'user',
acl: new SharingACL(acl.permissions)
};
$scope.share_settings.credentialSharedWithUserAndGroup.push(obj);
}
}
});
var acl = new SharingACL(0);

View file

@ -107,7 +107,7 @@ angular.module('passmanApp')
var queryUrl = OC.generateUrl('apps/passman/api/v2/sharing/credential/' + credential.guid +'/acl');
return $http.get(queryUrl).then(function (response) {
if (response.data) {
return response;
return response.data;
} else {
return response;
}