Commit bfbe4f45 authored by Sascha Pfeiffer's avatar Sascha Pfeiffer

some more progress

Signed-off-by: default avatarSascha Pfeiffer <sascha.pfeiffer@psono.com>
parent d6a07468
......@@ -252,7 +252,7 @@
//pass
};
managerFileRepository.delete_file_repository(file_repository.id)
managerFileRepository.decline(file_repository.file_repository_right_id)
.then(onSuccess, onError);
......
......@@ -140,7 +140,7 @@
$scope.bp.selected['link_id'] = cryptoLibrary.generate_uuid();
if ($scope.bp.selected.hasOwnProperty('preSave')) {
if ($scope.bp.selected.hasOwnProperty('preCreate')) {
var onSuccess = function(){
reset();
$uibModalInstance.close($scope.bp.selected);
......@@ -153,7 +153,7 @@
reset();
}
};
$scope.bp.selected.preSave($scope.bp.selected, parent, path)
$scope.bp.selected.preCreate($scope.bp.selected, parent, path)
.then(onSuccess, onError);
} else {
$scope.bp.selected['callback_data'] = $scope.data;
......
......@@ -2365,7 +2365,7 @@
*/
var create_file_repository_right = function (token, session_secret_key, file_repository_id, user_id, read, write,
grant) {
var endpoint = '/file-repository/right/';
var endpoint = '/file-repository-right/';
var connection_type = "PUT";
var data = {
file_repository_id: file_repository_id,
......@@ -2400,7 +2400,7 @@
* @returns {promise} promise
*/
var update_file_repository_right = function (token, session_secret_key, file_repository_right_id, read, write, grant) {
var endpoint = '/file-repository/right/';
var endpoint = '/file-repository-right/';
var connection_type = "POST";
var data = {
file_repository_right_id: file_repository_right_id,
......@@ -2430,7 +2430,7 @@
* @returns {promise} Returns a promise which can succeed or fail
*/
var delete_file_repository_right = function (token, session_secret_key, file_repository_right_id) {
var endpoint = '/file-repository/right/';
var endpoint = '/file-repository-right/';
var connection_type = "DELETE";
var data = {
file_repository_right_id: file_repository_right_id
......@@ -2459,7 +2459,7 @@
* @returns {promise} Returns a promise which can succeed or fail
*/
var accept_file_repository_right = function (token, session_secret_key, file_repository_right_id) {
var endpoint = '/file-repository/accept/';
var endpoint = '/file-repository-right/accept/';
var connection_type = "POST";
var data = {
file_repository_right_id: file_repository_right_id
......@@ -2487,7 +2487,7 @@
* @returns {promise} Returns a promise which can succeed or fail
*/
var decline_file_repository_right = function (token, session_secret_key, file_repository_right_id) {
var endpoint = '/file-repository/decline/';
var endpoint = '/file-repository-right/decline/';
var connection_type = "POST";
var data = {
file_repository_right_id: file_repository_right_id
......
......@@ -162,7 +162,7 @@
search: ['file_title'],
fields: [
{ name: "file_title", field: "input", type: "text", title: "TITLE", placeholder: "TITLE", required: true},
{ name: "file", field: "input", type: "file", title: "FILE", placeholder: "FILE", required: true, onChange: "onChangeData"},
{ name: "file", field: "input", type: "file", title: "FILE", placeholder: "FILE", required: true, onChange: "onChangeData", hidden_edit: true},
{ name: "file_id", field: "input", title: "FILE_ID", placeholder: "FILE_ID", hidden: true},
{ name: "file_shard_id", field: "input", title: "FILE_SHARD_ID", placeholder: "FILE_SHARD_ID", hidden: true},
{ name: "file_repository_id", field: "input", title: "FILE_REPOSITORY_ID", placeholder: "FILE_REPOSITORY_ID", hidden: true},
......@@ -173,6 +173,7 @@
],
hide_history: true,
hide_callback: true,
hide_offline: true,
non_secret_fields: ['file_title', 'file_id', 'file_shard_id', 'file_repository_id', 'file_secret_key', 'file_size', 'file_chunks'],
/**
......@@ -297,14 +298,12 @@
* @param parent
* @param path
*/
preSave: function(selected, parent, path){
preCreate: function(selected, parent, path){
var file_secret_key = cryptoLibrary.generate_secret_key();
//var file_chunk_size = 8*1024*1024; // in bytes. e.g. 8*1024*1024 Bytes = 8 MB
var file_chunk_size = 128*1024*1024; // in bytes. e.g. 128*1024*1024 Bytes = 128 MB
console.log(selected);
var is_file_repository_upload = selected['field_index']['file_destinations'].value['destination_type'] === 'file_repository';
var is_file_shard_upload = selected['field_index']['file_destinations'].value['destination_type'] === 'shard';
......@@ -548,6 +547,21 @@
return managerFileTransfer.create_file(shard_id, file_repository_id, size + chunk_count * 40, chunk_count, selected['link_id'], parent_datastore_id, parent_share_id)
.then(onSuccess, onError);
},
/**
* triggered before updating it.
*
* @param node
* @param secret_object
*/
preUpdate: function(node, secret_object){
var keys = Object.keys(secret_object);
for (var i = 0; i < keys.length; i++) {
node[keys[i]] = secret_object[keys[i]];
}
return $q.resolve()
}
};
......
......@@ -1733,6 +1733,7 @@
get_inaccessible_shares: get_inaccessible_shares,
get_all_own_pgp_keys: get_all_own_pgp_keys,
update_paths_recursive: update_paths_recursive,
update_share_rights_of_folders_and_items: update_share_rights_of_folders_and_items
};
};
......
......@@ -33,7 +33,8 @@
var onSuccess = function (result) {
return result.data;
};
var onError = function () {
var onError = function (data) {
console.log(data);
// pass
};
......@@ -183,6 +184,12 @@
var read_file_repository = function(file_repository_id) {
var onSuccess = function (result) {
var storage_object = storage.find_key('config', 'user_id');
if (storage_object && result.data.hasOwnProperty('file_repository_rights')) {
for (var i = 0; i < result.data['file_repository_rights'].length; i++) {
result.data['file_repository_rights'][i]['own_user'] = result.data['file_repository_rights'][i]['user_id'] === storage_object.value;
}
}
return result.data;
};
var onError = function () {
......@@ -385,8 +392,9 @@
return {
accept: accept,
decline: decline,
create_file_repository_right: create_file_repository_right,
update_file_repository_right : update_file_repository_right ,
update_file_repository_right : update_file_repository_right,
delete_file_repository_right: delete_file_repository_right,
get_possible_types: get_possible_types,
read_file_repository: read_file_repository,
......
......@@ -61,13 +61,41 @@
if (typeof parent.folders === 'undefined') {
parent.folders = [];
}
parent.folders.push({
var datastore_object = {
id: cryptoLibrary.generate_uuid(),
name: name
});
};
parent.folders.push(datastore_object);
parent['expanded'] = true;
var closest_share = managerShare.get_closest_parent_share(path.slice(), data_structure,
data_structure, 0);
if (closest_share.hasOwnProperty('share_id')) {
datastore_object['parent_share_id'] = closest_share['share_id'];
} else {
datastore_object['parent_datastore_id'] = closest_share['datastore_id'];
}
if (closest_share.hasOwnProperty('datastore_id')) {
datastore_object['share_rights'] = {
"read": true,
"write": true,
"grant": true,
"delete": true
};
} else {
datastore_object['share_rights'] = {
"read": closest_share['share_rights']['read'],
"write": closest_share['share_rights']['write'],
"grant": closest_share['share_rights']['grant'] && closest_share['share_rights']['write'],
"delete": closest_share['share_rights']['write']
};
}
managerDatastorePassword.update_paths_recursive(data_structure, []);
manager.save_datastore_content(data_structure, [path]);
......@@ -208,11 +236,27 @@
if (closest_share.hasOwnProperty('share_id')) {
parent_share_id = closest_share['share_id'];
datastore_object['parent_share_id'] = closest_share['share_id'];
} else {
parent_datastore_id = closest_share['datastore_id'];
datastore_object['parent_datastore_id'] = closest_share['datastore_id'];
}
managerDatastorePassword.update_paths_recursive(datastore, []);
if (closest_share.hasOwnProperty('datastore_id')) {
datastore_object['share_rights'] = {
"read": true,
"write": true,
"grant": true,
"delete": true
};
} else {
datastore_object['share_rights'] = {
"read": closest_share['share_rights']['read'],
"write": closest_share['share_rights']['write'],
"grant": closest_share['share_rights']['grant'] && closest_share['share_rights']['write'],
"delete": closest_share['share_rights']['write']
};
}
var save_datastore = function() {
......@@ -221,6 +265,8 @@
parent['expanded'] = true;
managerDatastorePassword.update_paths_recursive(datastore, []);
managerDatastorePassword.save_datastore_content(datastore, [path]);
// reset form fields
......@@ -311,14 +357,21 @@
managerDatastorePassword.save_datastore_content(datastore, [path]);
};
managerSecret.write_secret(
node.secret_id,
node.secret_key,
secret_object,
content['callback_data']['callback_url'],
content['callback_data']['callback_user'],
content['callback_data']['callback_pass'])
.then(onSuccess, onError);
var bp = itemBlueprint.get_blueprint(node.type);
if (bp.hasOwnProperty('preUpdate')) {
bp.preUpdate(node, secret_object)
.then(onSuccess, onError);
} else {
managerSecret.write_secret(
node.secret_id,
node.secret_key,
secret_object,
content['callback_data']['callback_url'],
content['callback_data']['callback_user'],
content['callback_data']['callback_pass'])
.then(onSuccess, onError);
}
}
......@@ -554,11 +607,9 @@
// find element
var val2 = managerDatastorePassword.find_in_datastore(item_path, datastore);
console.log("check1");
if (val2 === false) {
return;
}
console.log("check1 pass");
var element = val2[0][val2[1]];
// check if we have folders / items array, otherwise create the array
......@@ -566,12 +617,10 @@
target[type] = [];
}
console.log("check2");
//prevent the move of shares if rights are not sufficient
if (!canMoveFolder(element, target)) {
return;
}
console.log("check2 pass");
// add the element to the other folders / items
target[type].push(element);
......@@ -609,7 +658,6 @@
}
managerDatastorePassword.update_paths_recursive(datastore, []);
console.log(datastore);
// and save everything (before we update the links and might lose some necessary rights)
managerDatastorePassword.save_datastore_content(datastore, [orig_item_path, orig_target_path]);
......
......@@ -4,7 +4,7 @@
"INFO_NO_READ_RIGHTS_FOR_FILE_REPOSITORY_RIGHT": "Sie haben nicht die nötigen Berechtigungen um die Konfiguration des Datenrepositories einsehen zu können.",
"INFO_NO_GRANT_RIGHTS_FOR_FILE_REPOSITORY_RIGHT": "Sie haben nicht die nötigen Berechtigungen um die Rechte anderer Nutzer zu editieren.",
"CONFIG": "Konfiguration",
"RIGHTS": "Zugriffsberechtigungen",
"ACCESS_RIGHTS": "Zugriffsberechtigungen",
"USER_HAS_ALREADY_RIGHTS_FOR_FILE_REPOSITORY": "Der Benutzer hat bereits anderes Rechte an diesem Datei Repository",
"INVALID_EMAIL_IN_EMAIL": "Ungültige E-Mail im E-Mail Feld",
"INVALID_URL_IN_URL": "Ungültige URL im URL Feld",
......@@ -107,7 +107,7 @@
"UNLOCK": "Entsperren",
"UNLOCK_OFFLINE_CACHE": "Offline Cache entsperren",
"PICK_USER": "Benutzer auswählen",
"CLIENT_STORES_SECRETS_IN_LOCAL_STORAGE": "Der Client speichert alle Secrets (Passwörter, Notizen, Bookmarks, ...) im Local Storage des Clients. Alle werden mit der angegebenen Passphrase verschlüsselt.",
"CLIENT_STORES_SECRETS_IN_LOCAL_STORAGE": "Der Client speichert alle Secrets (Passwörter, Notizen, Bookmarks, ...) im Local Storage des Clients. Alle werden mit der angegebenen Passphrase verschlüsselt. Dateien werden nicht heruntergeladen.",
"PASSPHRASE": "Passphrase",
"PASSPHRASE_REPEAT": "Passphrase (wiederholen)",
"THE_CLIENT_IS_DOWNLOADING_ALL_CONTENT": "Der Client lädt gerade allen nötigen Content vom Server herunter.",
......
......@@ -4,7 +4,7 @@
"INFO_NO_READ_RIGHTS_FOR_FILE_REPOSITORY_RIGHT": "You do not have the necessary permissions to view the configuration of this data repository.",
"INFO_NO_GRANT_RIGHTS_FOR_FILE_REPOSITORY_RIGHT": "You do not have the necessary permissions to edit other users rights.",
"CONFIG": "Configuration",
"RIGHTS": "Access rights",
"ACCESS_RIGHTS": "Access rights",
"USER_HAS_ALREADY_RIGHTS_FOR_FILE_REPOSITORY": "The user has already other rights for this file repository",
"INVALID_EMAIL_IN_EMAIL": "Invalid email in email field",
"INVALID_URL_IN_URL": "Invalid URL in URL field",
......@@ -107,7 +107,7 @@
"UNLOCK": "Unlock",
"UNLOCK_OFFLINE_CACHE": "Unlock offline cache",
"PICK_USER": "Pick User",
"CLIENT_STORES_SECRETS_IN_LOCAL_STORAGE": "The client will store all secrets (passwords, notes, bookmarks, ...) in the local storage of the client. All of them will be encrypted with the passphrase that you provide.",
"CLIENT_STORES_SECRETS_IN_LOCAL_STORAGE": "The client will store all secrets (passwords, notes, bookmarks, ...) in the local storage of the client. All of them will be encrypted with the passphrase that you provide. Files are not downloaded.",
"PASSPHRASE": "Passphrase",
"PASSPHRASE_REPEAT": "Passphrase (repeat)",
"THE_CLIENT_IS_DOWNLOADING_ALL_CONTENT": "The client is now downloading all necessary content from the server.",
......
This diff is collapsed.
This diff is collapsed.
......@@ -53,7 +53,7 @@
</div>
</uib-tab>
<uib-tab heading="{{'RIGHTS' | translate}}">
<uib-tab heading="{{'ACCESS_RIGHTS' | translate}}">
<div ng-if="grant">
<br>
<button type="submit" class="btn btn-primary btn-primary pull-right" ng-click="create_file_repository_right()"><i class="fa fa-plus"></i> {{'ADD_RIGHT' | translate}}</button>
......@@ -74,19 +74,19 @@
<tr ng-repeat="file_repository_right in file_repository.file_repository_rights">
<td>{{file_repository_right.user_username | limitTo: 15 }}{{file_repository_right.user_username.length > 15 ? '...' : ''}}</td>
<td>
<button type="button" class="btn btn-default btn-sm" ng-click="toggle_read(file_repository_right)" ng-disabled="!grant">
<button type="button" class="btn btn-default btn-sm" ng-click="toggle_read(file_repository_right)" ng-disabled="!grant || file_repository_right.own_user">
<i ng-if="file_repository_right.read" class="fa fa-check" aria-hidden="true"><span style="display: none">1</span></i>
<i ng-if="!file_repository_right.read" class="fa fa-ban" aria-hidden="true"><span style="display: none">0</span></i>
</button>
</td>
<td>
<button type="button" class="btn btn-default btn-sm" ng-click="toggle_write(file_repository_right)" ng-disabled="!grant">
<button type="button" class="btn btn-default btn-sm" ng-click="toggle_write(file_repository_right)" ng-disabled="!grant || file_repository_right.own_user">
<i ng-if="file_repository_right.write" class="fa fa-check" aria-hidden="true"><span style="display: none">1</span></i>
<i ng-if="!file_repository_right.write" class="fa fa-ban" aria-hidden="true"><span style="display: none">0</span></i>
</button>
</td>
<td>
<button type="button" class="btn btn-default btn-sm" ng-click="toggle_grant(file_repository_right)" ng-disabled="!grant">
<button type="button" class="btn btn-default btn-sm" ng-click="toggle_grant(file_repository_right)" ng-disabled="!grant || file_repository_right.own_user">
<i ng-if="file_repository_right.grant" class="fa fa-check" aria-hidden="true"><span style="display: none">1</span></i>
<i ng-if="!file_repository_right.grant" class="fa fa-ban" aria-hidden="true"><span style="display: none">0</span></i>
</button>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment