mirror of
https://github.com/nextcloud/passman.git
synced 2024-09-20 23:06:24 +08:00
Merge branch 'sharing_no_groups' of github.com:nextcloud/passman into sharing_no_groups
This commit is contained in:
commit
167ffd4644
|
@ -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', 'NotificationService', function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService, NotificationService) {
|
||||
|
|
44
js/app/factory/sharingacl.js
Normal file
44
js/app/factory/sharingacl.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* 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: 0x02,
|
||||
FILES: 0x04,
|
||||
HISTORY: 0x08,
|
||||
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) {
|
||||
|
|
|
@ -12,9 +12,11 @@ namespace OCA\Passman\Utility;
|
|||
use OCP\AppFramework\Db\Entity;
|
||||
|
||||
class PermissionEntity extends Entity {
|
||||
CONST READ = 0b00000001;
|
||||
CONST WRITE = 0b00000010;
|
||||
CONST OWNER = 0b10000000;
|
||||
CONST READ = 0b00000001;
|
||||
CONST WRITE = 0b00000010;
|
||||
CONST FILES = 0b00000100;
|
||||
CONST HISTORY = 0b00001000;
|
||||
CONST OWNER = 0b10000000;
|
||||
|
||||
/**
|
||||
* Checks wether a user matches one or more permissions at once
|
||||
|
|
|
@ -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