Added SharingACL factory

Added license reference on some files
This commit is contained in:
Marcos Zuriaga 2016-10-03 14:45:38 +02:00
parent e38885ed41
commit bd838e9e46
No known key found for this signature in database
GPG key ID: 7D15585354D072FF
4 changed files with 45 additions and 0 deletions

View file

@ -6,6 +6,7 @@
* @description
* # MainCtrl
* Controller of the passmanApp
* This file is part of passman, licensed under AGPLv3
*/
angular.module('passmanApp')
.controller('ShareCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService) {

View file

@ -0,0 +1,42 @@
/**
* Created by Marcos Zuriaga on 3/10/16.
* This file is part of passman, licensed under AGPLv3
*/
angular.module('passmanApp').factory('SharingACL', function(){
function ACL(acl_permission){
var permission = acl_permission;
var permissions = {
READ: 0x01,
WRITE: 0x03,
OWNER: 0x80,
};
}
/**
* Checks if a user has the given permission/s
* @param permission
* @returns {boolean}
*/
ACL.prototype.hasPermission = function(permission){
return this.permission == (this.permission & permission);
};
/**
* Adds a permission to a user, leaving any other permissions intact
* @param permission
*/
ACL.prototype.addPermission = function(permission){
this.permission = this.permission | permission;
};
/**
* Removes a given permission from the item, leaving any other intact
* @param permission
*/
ACL.prototype.removePermission = function(permission){
this.permission = this.permission & !permission;
};
return ACL;
});

View file

@ -6,6 +6,7 @@
* @description
* # ShareService
* Service in the passmanApp.
* This file is part of passman, licensed under AGPLv3
*/
angular.module('passmanApp')
.service('ShareService', ['$http', 'VaultService', 'EncryptService', 'CredentialService', function ($http, VaultService, EncryptService, CredentialService) {

View file

@ -54,6 +54,7 @@ script('passman', 'app/services/encryptservice');
script('passman', 'app/services/tagservice');
script('passman', 'app/services/notificationservice');
script('passman', 'app/services/shareservice');
script('passman', 'app/factory/sharingacl');
script('passman', 'app/directives/passwordgen');
script('passman', 'app/directives/fileselect');
script('passman', 'app/directives/progressbar');