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
|
* @description
|
||||||
* # MainCtrl
|
* # MainCtrl
|
||||||
* Controller of the passmanApp
|
* Controller of the passmanApp
|
||||||
|
* This file is part of passman, licensed under AGPLv3
|
||||||
*/
|
*/
|
||||||
angular.module('passmanApp')
|
angular.module('passmanApp')
|
||||||
.controller('ShareCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'ShareService', 'NotificationService', function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, ShareService, NotificationService) {
|
.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
|
* @description
|
||||||
* # ShareService
|
* # ShareService
|
||||||
* Service in the passmanApp.
|
* Service in the passmanApp.
|
||||||
|
* This file is part of passman, licensed under AGPLv3
|
||||||
*/
|
*/
|
||||||
angular.module('passmanApp')
|
angular.module('passmanApp')
|
||||||
.service('ShareService', ['$http', 'VaultService', 'EncryptService', 'CredentialService', function ($http, VaultService, EncryptService, CredentialService) {
|
.service('ShareService', ['$http', 'VaultService', 'EncryptService', 'CredentialService', function ($http, VaultService, EncryptService, CredentialService) {
|
||||||
|
|
|
@ -14,6 +14,8 @@ use OCP\AppFramework\Db\Entity;
|
||||||
class PermissionEntity extends Entity {
|
class PermissionEntity extends Entity {
|
||||||
CONST READ = 0b00000001;
|
CONST READ = 0b00000001;
|
||||||
CONST WRITE = 0b00000010;
|
CONST WRITE = 0b00000010;
|
||||||
|
CONST FILES = 0b00000100;
|
||||||
|
CONST HISTORY = 0b00001000;
|
||||||
CONST OWNER = 0b10000000;
|
CONST OWNER = 0b10000000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,6 +54,7 @@ script('passman', 'app/services/encryptservice');
|
||||||
script('passman', 'app/services/tagservice');
|
script('passman', 'app/services/tagservice');
|
||||||
script('passman', 'app/services/notificationservice');
|
script('passman', 'app/services/notificationservice');
|
||||||
script('passman', 'app/services/shareservice');
|
script('passman', 'app/services/shareservice');
|
||||||
|
script('passman', 'app/factory/sharingacl');
|
||||||
script('passman', 'app/directives/passwordgen');
|
script('passman', 'app/directives/passwordgen');
|
||||||
script('passman', 'app/directives/fileselect');
|
script('passman', 'app/directives/fileselect');
|
||||||
script('passman', 'app/directives/progressbar');
|
script('passman', 'app/directives/progressbar');
|
||||||
|
|
Loading…
Reference in a new issue