Commit 282022b9 authored by chickahoona's avatar chickahoona

more ngdocs

parent 650cbe22
......@@ -67,13 +67,13 @@
<div snap-drawer class="dark">
<h2>Navigation</h2>
<ul class="navigations">
<li ng-class="getLinkState('/')"><a href="#">Home</a></li>
<!--<li ng-class="getLinkState('/test')"><a href="#/test">Test</a></li>-->
<li ng-class="get_link_state('/')"><a href="#">Home</a></li>
<!--<li ng-class="get_link_state('/test')"><a href="#/test">Test</a></li>-->
</ul>
<h2>Share Details</h2>
<ul class="navigations">
<li ng-class="getLinkState('/share/pendingshares')"><a href="#/share/pendingshares">Pending Requests</a></li>
<li ng-class="getLinkState('/share/users')"><a href="#/share/users">Trusted Users</a></li>
<li ng-class="get_link_state('/share/pendingshares')"><a href="#/share/pendingshares">Pending Requests</a></li>
<li ng-class="get_link_state('/share/users')"><a href="#/share/users">Trusted Users</a></li>
</ul>
<h2>More</h2>
<ul class="navigations">
......
......@@ -479,8 +479,8 @@
*
* @type {Function}
*/
scope.getItemIconClass = typeof options.itemIcon === 'function'
? options.itemIcon
scope.getItemIconClass = typeof options.item_icon === 'function'
? options.item_icon
: function (item) {
return 'fa fa-item';
};
......@@ -711,7 +711,7 @@
* @param item
* @param event
*/
scope.deleteItem = function (item, event) {
scope.delete_item = function (item, event) {
event.preventDefault();
if (typeof options.onDeleteItem === "function") {
......@@ -1004,7 +1004,7 @@
' ng-class="{hidden: item.share_rights.delete == false || item.share_rights.read == false}"></li>' +
' <li role="menuitem"' +
' ng-class="{hidden: item.share_rights.delete == false}"' +
' ng-click="deleteItem(item, $event)">' +
' ng-click="delete_item(item, $event)">' +
' <a href="#"><i class="fa fa-trash"></i>Delete</a>' +
' </li>' +
'</ul>' +
......@@ -1034,7 +1034,7 @@
' ng-class="{hidden: item.share_rights.delete == false || item.share_rights.read == false}"></li>' +
' <li role="menuitem"' +
' ng-class="{hidden: item.share_rights.delete == false}"' +
' ng-click="deleteItem(item, $event)">' +
' ng-click="delete_item(item, $event)">' +
' <a href="#"><i class="fa fa-trash"></i>Delete</a>' +
' </li>' +
'</ul>' +
......
......@@ -38,6 +38,12 @@
* @property {Array} [folders] The folders in the tree object containing other TreeObject
* @property {Object} [share_index] The share index
*
* @typedef {Object} RightObject
* @property {boolean} read The read rights
* @property {boolean} write The write rights
* @property {boolean} grant The grant rights
* @property {boolean} [delete] The delete rights
*
*/
......@@ -168,7 +174,7 @@
$rootScope.$on('$routeChangeSuccess', function () {
var redirect = '/secret/';
if ($location.path().substring(0, redirect.length) == redirect && $routeParams.hasOwnProperty('secret_id')) {
managerSecret.redirectSecret($routeParams.type, $routeParams.secret_id);
managerSecret.redirect_secret($routeParams.type, $routeParams.secret_id);
}
});
......@@ -657,7 +663,7 @@
/**
* @ngdoc
* @name psonocli.controller:MainCtrl#getLinkState
* @name psonocli.controller:MainCtrl#get_link_state
* @methodOf psonocli.controller:MainCtrl
*
* @description
......@@ -666,7 +672,7 @@
*
* @param {string} path The current path
*/
$scope.getLinkState = function (path) {
$scope.get_link_state = function (path) {
if (path === '/' && $location.path().length == 0) {
return 'active';
} else if (path !== '/' && $location.path().substr(0, path.length) === path) {
......@@ -688,13 +694,13 @@
/**
* @ngdoc
* @name psonocli.controller:MainCtrl#generatePassword
* @name psonocli.controller:MainCtrl#generate_password
* @methodOf psonocli.controller:MainCtrl
*
* @description
* managerDatastorePassword.generate_password_active_tab function to pass through
*/
$scope.generatePassword = managerDatastorePassword.generate_password_active_tab;
$scope.generate_password = managerDatastorePassword.generate_password_active_tab;
$scope.user_username = manager.find_one('config', 'user_username');
......@@ -765,13 +771,13 @@
/**
* @ngdoc
* @name psonocli.controller:PanelCtrl#generatePassword
* @name psonocli.controller:PanelCtrl#generate_password
* @methodOf psonocli.controller:PanelCtrl
*
* @description
* managerDatastorePassword.generate_password_active_tab function to pass through
*/
$scope.generatePassword = managerDatastorePassword.generate_password_active_tab;
$scope.generate_password = managerDatastorePassword.generate_password_active_tab;
/* datastore search */
......@@ -1238,7 +1244,7 @@
/**
* @ngdoc
* @name psonocli.controller:ShareCtrl#pendingApprovalFilter
* @name psonocli.controller:ShareCtrl#pending_approval_filter
* @methodOf psonocli.controller:ShareCtrl
*
* @description
......@@ -1246,7 +1252,7 @@
*
* @param {object} item The item to check
*/
$scope.pendingApprovalFilter = function (item) {
$scope.pending_approval_filter = function (item) {
return item.share_right_accepted === null;
};
}]);
......@@ -1304,13 +1310,13 @@
/**
* @ngdoc
* @name psonocli.controller:ModalAcceptShareCtrl#clearBreadcrumbs
* @name psonocli.controller:ModalAcceptShareCtrl#clear_breadcrumbs
* @methodOf psonocli.controller:ModalAcceptShareCtrl
*
* @description
* triggered once someone clicks the "delete" button near path. The function will clear the breadcrumbs.
*/
$scope.clearBreadcrumbs = function () {
$scope.clear_breadcrumbs = function () {
$scope.breadcrumbs = {};
};
......
This diff is collapsed.
......@@ -22,7 +22,7 @@
/**
* @ngdoc
* @name psonocli.managerAdfWidget#openNewFolder
* @name psonocli.managerAdfWidget#open_new_folder
* @methodOf psonocli.managerAdfWidget
*
* @description
......@@ -33,7 +33,7 @@
* @param {TreeObject} data_structure the data structure
* @param {Object} manager manager responsible for
*/
var openNewFolder = function (parent, path, data_structure, manager) {
var open_new_folder = function (parent, path, data_structure, manager) {
var modalInstance = $uibModal.open({
templateUrl: 'view/modal-new-folder.html',
......@@ -70,7 +70,7 @@
/**
* @ngdoc
* @name psonocli.managerAdfWidget#openEditFolder
* @name psonocli.managerAdfWidget#open_edit_folder
* @methodOf psonocli.managerAdfWidget
*
* @description
......@@ -82,7 +82,7 @@
* @param {Object} manager manager responsible for
* @param {string} size The size of the modal
*/
var openEditFolder = function (node, path, data_structure, manager, size) {
var open_edit_folder = function (node, path, data_structure, manager, size) {
var modalInstance = $uibModal.open({
templateUrl: 'view/modal-edit-folder.html',
......@@ -110,7 +110,7 @@
/**
* @ngdoc
* @name psonocli.managerAdfWidget#openNewItem
* @name psonocli.managerAdfWidget#open_new_item
* @methodOf psonocli.managerAdfWidget
*
* @description
......@@ -121,7 +121,7 @@
* @param {Array} path The path to the parent
* @param {string} size The size of the modal
*/
var openNewItem = function (datastore, parent, path, size) {
var open_new_item = function (datastore, parent, path, size) {
var modalInstance = $uibModal.open({
templateUrl: 'view/modal-new-entry.html',
controller: 'ModalDatastoreNewEntryCtrl',
......@@ -206,7 +206,7 @@
/**
* @ngdoc
* @name psonocli.managerAdfWidget#openEditItem
* @name psonocli.managerAdfWidget#open_edit_item
* @methodOf psonocli.managerAdfWidget
*
* @description
......@@ -217,7 +217,7 @@
* @param {Array} path The path to the parent
* @param {string} size The size of the modal
*/
var openEditItem = function(datastore, node, path, size) {
var open_edit_item = function(datastore, node, path, size) {
var onError = function(result) {
// pass
......@@ -285,7 +285,7 @@
/**
* @ngdoc
* @name psonocli.managerAdfWidget#moveItem
* @name psonocli.managerAdfWidget#move_item
* @methodOf psonocli.managerAdfWidget
*
* @description
......@@ -296,7 +296,7 @@
* @param {Array} target_path the path where we want to put the item
* @param {string} type type of the item ('item' or 'folder')
*/
var moveItem = function(datastore, item_path, target_path, type) {
var move_item = function(datastore, item_path, target_path, type) {
/**
* takes any element like shares, folders, items ... and checks if they can be moved
......@@ -494,7 +494,7 @@
/**
* @ngdoc
* @name psonocli.managerAdfWidget#deleteItem
* @name psonocli.managerAdfWidget#delete_item
* @methodOf psonocli.managerAdfWidget
*
* @description
......@@ -504,7 +504,7 @@
* @param {object} item The item to delete
* @param {Array} path The path to the item
*/
var deleteItem = function(datastore, item, path) {
var delete_item = function(datastore, item, path) {
var i;
// TODO ask for confirmation
......@@ -560,7 +560,7 @@
/**
* @ngdoc
* @name psonocli.managerAdfWidget#findInStructure
* @name psonocli.managerAdfWidget#find_in_structure
* @methodOf psonocli.managerAdfWidget
*
* @description
......@@ -570,7 +570,7 @@
* @param {TreeObject} structure The structure object tree
* @returns {boolean|Array} False if not present or a list of two objects where the first is the List Object containing the searchable object and the second the index
*/
var findInStructure = function (path, structure) {
var find_in_structure = function (path, structure) {
var to_search = path.shift();
var n = undefined;
......@@ -602,7 +602,7 @@
for (n = 0; n < structure.folders.length; n++) {
if (structure.folders[n].id == to_search) {
return findInStructure(path, structure.folders[n]);
return find_in_structure(path, structure.folders[n]);
}
}
return false;
......@@ -610,7 +610,7 @@
/**
* @ngdoc
* @name psonocli.managerAdfWidget#itemIcon
* @name psonocli.managerAdfWidget#item_icon
* @methodOf psonocli.managerAdfWidget
*
* @description
......@@ -620,7 +620,7 @@
*
* @returns {string} Returns the css class
*/
var itemIcon = function (item) {
var item_icon = function (item) {
var iconClassMap = {
txt: 'fa fa-file-text-o',
log: 'fa fa-file-text-o',
......@@ -675,14 +675,14 @@
};
return {
openNewFolder: openNewFolder,
openEditFolder: openEditFolder,
findInStructure: findInStructure,
openNewItem: openNewItem,
openEditItem: openEditItem,
moveItem: moveItem,
deleteItem: deleteItem,
itemIcon: itemIcon
open_new_folder: open_new_folder,
open_edit_folder: open_edit_folder,
find_in_structure: find_in_structure,
open_new_item: open_new_item,
open_edit_item: open_edit_item,
move_item: move_item,
delete_item: delete_item,
item_icon: item_icon
};
};
......@@ -1006,13 +1006,13 @@
/**
* @ngdoc
* @name psonocli.controller:ModalShareEntryCtrl#addUser
* @name psonocli.controller:ModalShareEntryCtrl#add_user
* @methodOf psonocli.controller:ModalShareEntryCtrl
*
* @description
* responsible to add a user to the known users datastore
*/
$scope.addUser = function() {
$scope.add_user = function() {
var modalInstance = $uibModal.open({
templateUrl: 'view/modal-new-entry.html',
......
(function(angular) {
'use strict';
/**
* @ngdoc service
* @name psonocli.managerDatastoreSetting
* @requires psonocli.storage
* @requires psonocli.managerDatastore
*
* @description
* Service to manage the setting datastore
*/
var managerDatastoreSetting = function(storage, managerDatastore) {
/**
* @ngdoc
* @name psonocli.managerDatastoreSetting#get_settings_datastore
* @methodOf psonocli.managerDatastoreSetting
*
* @description
* Returns the settings datastore.
*
* @returns {promise}
* @returns {promise} Returns the settings datastore
*/
var get_settings_datastore = function() {
var type = "settings";
......@@ -35,12 +50,15 @@
};
/**
* @ngdoc
* @name psonocli.managerDatastoreSetting#save_settings_datastore
* @methodOf psonocli.managerDatastoreSetting
*
* @description
* Saves the settings datastore with given content
*
* @param content The real object you want to encrypt in the datastore
* @returns {promise}
* @private
* @param {TreeObject} content The real object you want to encrypt in the datastore
* @returns {promise} Promise with the status of the save
*/
var save_settings_datastore = function (content) {
var type = "settings";
......
(function(angular) {
'use strict';
/**
* @ngdoc service
* @name psonocli.managerDatastoreUser
* @requires $q
* @requires $rootScope
* @requires psonocli.apiClient
* @requires psonocli.browserClient
* @requires psonocli.storage
* @requires psonocli.helper
* @requires psonocli.managerBase
* @requires psonocli.managerDatastore
* @requires psonocli.shareBlueprint
* @requires psonocli.itemBlueprint
* @requires psonocli.cryptoLibrary
*
* @description
* Service to manage the user datastore and user related functions
*/
var managerDatastoreUser = function($q, $rootScope, apiClient, browserClient, storage,
helper, managerBase, managerDatastore, shareBlueprint,
itemBlueprint, cryptoLibrary) {
/**
* @ngdoc
* @name psonocli.managerDatastoreUser#is_logged_in
* @methodOf psonocli.managerDatastoreUser
*
* @description
* Checks if the user is logged in.
* Returns either true or false
*
* @return {boolean} is the user logged in
* @return {boolean} Returns either if the user is logged in
*/
var is_logged_in = function () {
var token = managerBase.get_token();
......@@ -17,12 +40,18 @@
};
/**
* Ajax POST request to the backend with email and authkey for registration
* @ngdoc
* @name psonocli.managerDatastoreUser#register
* @methodOf psonocli.managerDatastoreUser
*
* @param email
* @param username
* @param password
* @param server server object
* @description
* Responsible for the registration. Generates the users public-private-key-pair together with the secret
* key and the user sauce. Encrypts the sensible data before initiating the register call with the api client.
*
* @param {email} email The email to register with
* @param {string} username The username to register with
* @param {string} password The password to register with
* @param {string} server The server object
*
* @returns {promise} promise
*/
......@@ -80,12 +109,17 @@
};
/**
* @ngdoc
* @name psonocli.managerDatastoreUser#activate
* @methodOf psonocli.managerDatastoreUser
*
* @description
* Activates a user account with the provided activation code
*
* @param activate_code
* @param server
* @param {string} activate_code The activation code sent via mail
* @param {string} server The server to send the activation code to
*
* @returns {promise}
* @returns {promise} Returns a promise with the activation status
*/
var activate = function(activate_code, server) {
......@@ -116,14 +150,20 @@
};
/**
* @ngdoc
* @name psonocli.managerDatastoreUser#login
* @methodOf psonocli.managerDatastoreUser
*
* @description
* Ajax POST request to the backend with username and authkey for login, saves a token together with user_id
* and all the different keys of a user in the apidata storage
* and all the different keys of a user in the api data storage.
* Also handles the validation of the token with the server by solving the cryptographic puzzle
*
* @param username
* @param password
* @param server server object
* @param {string} username The username to login with
* @param {string} password The password to login with
* @param {object} server The server object to send the login request to
*
* @returns {promise} promise
* @returns {promise} Returns a promise with the login status
*/
var login = function(username, password, server) {
......@@ -220,9 +260,14 @@
};
/**
* @ngdoc
* @name psonocli.managerDatastoreUser#logout
* @methodOf psonocli.managerDatastoreUser
*
* @description
* Ajax POST request to destroy the token and logout the user
*
* @returns {promise}
* @returns {promise} Returns a promise with the logout status
*/
var logout = function () {
......@@ -264,18 +309,23 @@
});
/**
* @ngdoc
* @name psonocli.managerDatastoreUser#update_user
* @methodOf psonocli.managerDatastoreUser
*
* @description
* Update user base settings
*
* @param email
* @param authkey
* @param authkey_old
* @param private_key
* @param private_key_nonce
* @param secret_key
* @param secret_key_nonce
* @param user_sauce
* @param {email} email The email of the user
* @param {string} authkey The new authkey of the user
* @param {string} authkey_old The old authkey of the user
* @param {string} private_key The encrypted private key of the user (hex format)
* @param {string} private_key_nonce The nonce of the private key (hex format)
* @param {string} secret_key The encrypted secret key of the user (hex format)
* @param {string} secret_key_nonce The nonce of the secret key (hex format)
* @param {string} user_sauce The user sauce (hex format)
*
* @returns {promise}
* @returns {promise} Returns a promise with the update status
*/
var update_user = function(email, authkey, authkey_old, private_key, private_key_nonce, secret_key,
secret_key_nonce, user_sauce) {
......@@ -284,10 +334,15 @@
};
/**
* @ngdoc
* @name psonocli.managerDatastoreUser#get_user_datastore
* @methodOf psonocli.managerDatastoreUser
*
* @description
* Returns the user datastore. In addition this function triggers the generation of the local datastore
* storage to
*
* @returns {promise}
* @returns {promise} Returns a promise with the user datastore
*/
var get_user_datastore = function() {
var type = "user";
......@@ -315,15 +370,19 @@
};
/**
* @ngdoc
* @name psonocli.managerDatastoreUser#search_user_datastore
* @methodOf psonocli.managerDatastoreUser
*
* @description
* searches the user datastore for a user, based on the id or email
*
* @param [user_id] (optional) user_id to search for
* @param [email] (optional) email to search for
* @returns {promise}
* @param {uuid} [user_id] (optional) user_id to search for
* @param {email} [email] (optional) email to search for
* @returns {promise} Returns a promise with the user
*/
var search_user_datastore = function(user_id, email) {
var onSuccess = function (user_data_store) {
var users = [];
......@@ -369,11 +428,16 @@
};
/**
* @ngdoc
* @name psonocli.managerDatastoreUser#save_datastore
* @methodOf psonocli.managerDatastoreUser
*
* @description
* Saves the user datastore with given content
*
* @param content The real object you want to encrypt in the datastore
* @param paths The list of paths to the changed elements
* @returns {promise}
* @param {TreeObject} content The real object you want to encrypt in the datastore
* @param {Array} paths The list of paths to the changed elements
* @returns {promise} Promise with the status of the save
*/
var save_datastore = function (content, paths) {
var type = "user";
......@@ -385,10 +449,15 @@
};
/**
* @ngdoc
* @name psonocli.managerDatastoreUser#search_user
* @methodOf psonocli.managerDatastoreUser
*
* @description
* searches a user in the database according to his username
*
* @param username
* @returns {promise}
* @param {string} username The username to search
* @returns {promise} Returns a promise with the user information
*/
var search_user = function(username) {
......
......@@ -69,7 +69,7 @@
*
* @param {string} type The type of the datastore that we are looking for
* @param {string} description The description of the datastore that we are looking for
* @param {boolean} [force_fresh] if you want to force a fresh query to the backend
* @param {boolean} [force_fresh] (optional) if you want to force a fresh query to the backend
*
* @returns {promise} Promise with the datastore id
*/
......
(function(angular) {
'use strict';
/**
* @ngdoc service
* @name psonocli.managerSecretLink
* @requires psonocli.managerBase
* @requires psonocli.apiClient
*
* @description
* Service to handle all secret links related tasks
*/
var managerSecretLink = function(managerBase, apiClient) {
/**
* @ngdoc
* @name psonocli.managerSecretLink#move_secret_link
* @methodOf psonocli.managerSecretLink
*
* @description
* Moves a secret to a new parent share or datastore
*
* @param {uuid} link_id - the link id
* @param {uuid} [new_parent_share_id=null] - optional new parent share ID, necessary if no new_parent_datastore_id is provided
* @param {uuid} [new_parent_datastore_id=null] - optional new datastore ID, necessary if no new_parent_share_id is provided
* @param {uuid} link_id The id of the link that should be moved
* @param {uuid} [new_parent_share_id=null] (optional) New parent share ID, necessary if no new_parent_datastore_id is provided
* @param {uuid} [new_parent_datastore_id=null] (optional) New datastore ID, necessary if no new_parent_share_id is provided
*
* @returns {promise}
* @returns {promise} Returns promise with the status of the move
*/
var move_secret_link = function(link_id, new_parent_share_id, new_parent_datastore_id) {
......@@ -28,11 +43,16 @@
};
/**
* Deletes a secret
* @ngdoc
* @name psonocli.managerSecretLink#delete_secret_link
* @methodOf psonocli.managerSecretLink
*
* @param {uuid} link_id - the link id
* @description
* Deletes a link to a secret
*
* @returns {promise}
* @param {uuid} link_id The id of the link that should be deleted
*
* @returns {promise} Returns a promise with the status of the delete operation
*/
var delete_secret_link = function(link_id) {
......@@ -50,19 +70,26 @@
};
/**
* @ngdoc
* @name psonocli.managerSecretLink#on_secret_moved
* @methodOf psonocli.managerSecretLink
*
* @description
* triggered once a secret moved. handles the update of links
*
* @param link_id
* @param parent_share
* @param {uuid} link_id The id of the link
* @param {object} parent The new parent (share or datastore)
*
* @returns {promise} Returns promise with the status of the move
*/
var on_secret_moved = function(link_id, parent_share) {
var on_secret_moved = function(link_id, parent) {
var new_parent_share_id = null,
new_parent_datastore_id = null;
if (parent_share.hasOwnProperty("share_id")) {
new_parent_share_id = parent_share.share_id;
} else if(parent_share.hasOwnProperty("datastore_id")) {
new_parent_datastore_id = parent_share.datastore_id;
if (parent.hasOwnProperty("share_id")) {
new_parent_share_id = parent.share_id;
} else if(parent.hasOwnProperty("datastore_id")) {