mirror of
https://github.com/nextcloud/passman.git
synced 2024-12-26 17:43:26 +08:00
Added SharingACL factory
Added license reference on some files
This commit is contained in:
parent
e38885ed41
commit
bd838e9e46
4 changed files with 45 additions and 0 deletions
|
@ -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) {
|
||||
|
|
42
js/app/factory/sharingacl.js
Normal file
42
js/app/factory/sharingacl.js
Normal 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;
|
||||
});
|
|
@ -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) {
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue