Merge branch 'master' of ssh://**REDACTED**/~/_cakephp/gradido_single_node

This commit is contained in:
Dario 2020-11-30 09:32:45 +01:00
commit 406dc13412
26 changed files with 155 additions and 109 deletions

View File

@ -1,5 +1,5 @@
CREATE TABLE `admin_errors` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`state_user_id` int(11) NOT NULL,
`controller` varchar(255) NOT NULL,
`action` varchar(255) NOT NULL,

View File

@ -1,8 +1,9 @@
CREATE TABLE `community_profiles` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`state_user_id` INT UNSIGNED NOT NULL,
`profile_img` LONGBLOB NULL,
`profile_desc` VARCHAR(2000) NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`state_user_id` int(10) unsigned NOT NULL,
`profile_img` longblob,
`profile_desc` varchar(2000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`state_user_id`) REFERENCES `state_users`(`id`)
) ENGINE=InnoDB;
KEY `state_user_id` (`state_user_id`),
CONSTRAINT `community_profiles_ibfk_1` FOREIGN KEY (`state_user_id`) REFERENCES `state_users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,6 +1,6 @@
CREATE TABLE `operator_types` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(25) NOT NULL,
`text` varchar(255) NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
`text` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,8 +1,8 @@
CREATE TABLE `operators` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`user_pubkey` binary(32) NOT NULL,
`data_base64` varchar(255) NOT NULL,
`data_base64` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,10 +1,10 @@
CREATE TABLE `pending_transactions` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`transactionID` varchar(25) NOT NULL,
`service` varchar(20) NOT NULL,
`method` varchar(20) NOT NULL,
`h_server_id` int NOT NULL,
`timeout` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`transactionID` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
`service` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`method` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`h_server_id` int(11) NOT NULL,
`timeout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `transactionID` (`transactionID`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -0,0 +1,5 @@
CREATE TABLE `roles` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,12 +1,12 @@
CREATE TABLE `server_users` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(50) NOT NULL,
`role` varchar(20) NOT NULL DEFAULT 'admin',
`activated` tinyint NOT NULL DEFAULT 0,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`role` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'admin',
`activated` tinyint(4) NOT NULL DEFAULT '0',
`last_login` datetime DEFAULT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,7 +1,7 @@
CREATE TABLE `state_balances` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`state_user_id` int UNSIGNED NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`state_user_id` int(10) unsigned NOT NULL,
`modified` datetime NOT NULL,
`amount` bigint NOT NULL,
`amount` bigint(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,11 +1,11 @@
CREATE TABLE `state_created` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`transaction_id` int UNSIGNED NOT NULL,
`month` tinyint UNSIGNED NOT NULL,
`year` smallint UNSIGNED NOT NULL,
`state_user_id` int UNSIGNED NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`transaction_id` int(10) unsigned NOT NULL,
`month` tinyint(3) unsigned NOT NULL,
`year` smallint(5) unsigned NOT NULL,
`state_user_id` int(10) unsigned NOT NULL,
`created` datetime NOT NULL,
`short_ident_hash` int UNSIGNED NOT NULL,
`short_ident_hash` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `short_ident_hash` (`short_ident_hash`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,8 +1,8 @@
CREATE TABLE `state_errors` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`state_user_id` int UNSIGNED NOT NULL,
`transaction_type_id` int UNSIGNED NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`state_user_id` int(10) unsigned NOT NULL,
`transaction_type_id` int(10) unsigned NOT NULL,
`created` datetime NOT NULL,
`message_json` text NOT NULL,
`message_json` text COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,7 +1,7 @@
CREATE TABLE `state_group_addresses` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`group_id` int UNSIGNED NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`group_id` int(10) unsigned NOT NULL,
`public_key` binary(32) NOT NULL,
`address_type_id` int UNSIGNED NOT NULL,
`address_type_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,7 +1,7 @@
CREATE TABLE `state_group_relationships` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`group1_id` int UNSIGNED NOT NULL,
`group2_id` int UNSIGNED NOT NULL,
`state_relationship_id` int UNSIGNED NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`group1_id` int(10) unsigned NOT NULL,
`group2_id` int(10) unsigned NOT NULL,
`state_relationship_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,8 +1,8 @@
CREATE TABLE `state_groups` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`index_id` varbinary(64) NOT NULL,
`name` varchar(50) NOT NULL,
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`root_public_key` binary(32) NOT NULL,
`user_count` smallint UNSIGNED NOT NULL DEFAULT 0,
`user_count` smallint(5) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,6 +1,6 @@
CREATE TABLE `state_relationship_types` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(25) NOT NULL,
`text` varchar(255) DEFAULT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
`text` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -0,0 +1,6 @@
CREATE TABLE `state_user_roles` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`state_user_id` int(11) NOT NULL,
`role_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,13 +1,13 @@
CREATE TABLE `state_users` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`index_id` smallint NOT NULL DEFAULT 0,
`group_id` int UNSIGNED NOT NULL DEFAULT 0,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`index_id` smallint(6) NOT NULL DEFAULT '0',
`group_id` int(10) unsigned NOT NULL DEFAULT '0',
`public_key` binary(32) NOT NULL,
`email` varchar(255) DEFAULT NULL,
`first_name` varchar(255) DEFAULT NULL,
`last_name` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`disabled` tinyint DEFAULT 0,
`email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`first_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`last_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`username` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`disabled` tinyint(4) DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `public_key` (`public_key`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,9 +1,9 @@
CREATE TABLE `transaction_creations` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`transaction_id` int UNSIGNED NOT NULL,
`state_user_id` int UNSIGNED NOT NULL,
`amount` bigint NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`transaction_id` int(10) unsigned NOT NULL,
`state_user_id` int(10) unsigned NOT NULL,
`amount` bigint(20) NOT NULL,
`ident_hash` binary(32) NOT NULL,
`target_date` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,7 +1,7 @@
CREATE TABLE `transaction_group_addaddress` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`transaction_id` int UNSIGNED NOT NULL,
`address_type_id` int UNSIGNED NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`transaction_id` int(10) unsigned NOT NULL,
`address_type_id` int(10) unsigned NOT NULL,
`public_key` binary(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,7 +1,7 @@
CREATE TABLE `transaction_group_allowtrades` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`transaction_id` int UNSIGNED NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`transaction_id` int(10) unsigned NOT NULL,
`remote_group_id` varbinary(64) NOT NULL,
`allow` tinyint NOT NULL DEFAULT 0,
`allow` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,8 +1,8 @@
CREATE TABLE `transaction_group_creates` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`transaction_id` int UNSIGNED NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`transaction_id` int(10) unsigned NOT NULL,
`group_public_key` binary(32) NOT NULL,
`group_id` varchar(64) NOT NULL,
`name` varchar(64) NOT NULL,
`group_id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,10 +1,10 @@
CREATE TABLE `transaction_send_coins` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`transaction_id` int UNSIGNED NOT NULL,
`state_user_id` int UNSIGNED NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`transaction_id` int(10) unsigned NOT NULL,
`state_user_id` int(10) unsigned NOT NULL,
`receiver_public_key` binary(32) NOT NULL,
`receiver_user_id` int UNSIGNED NOT NULL,
`amount` bigint NOT NULL,
`sender_final_balance` bigint NOT NULL,
`receiver_user_id` int(10) unsigned NOT NULL,
`amount` bigint(20) NOT NULL,
`sender_final_balance` bigint(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,7 +1,7 @@
CREATE TABLE `transaction_signatures` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`transaction_id` int UNSIGNED NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`transaction_id` int(10) unsigned NOT NULL,
`signature` binary(64) NOT NULL,
`pubkey` binary(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,6 +1,6 @@
CREATE TABLE `transaction_types` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(24) NOT NULL,
`text` varchar(255) NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(24) COLLATE utf8mb4_unicode_ci NOT NULL,
`text` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -1,9 +1,9 @@
CREATE TABLE `transactions` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`state_group_id` int UNSIGNED DEFAULT NULL,
`transaction_type_id` int UNSIGNED NOT NULL,
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`state_group_id` int(10) unsigned DEFAULT NULL,
`transaction_type_id` int(10) unsigned NOT NULL,
`tx_hash` binary(32) DEFAULT NULL,
`memo` varchar(255) NOT NULL,
`received` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`memo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`received` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -58,11 +58,29 @@ class JsonRequestHandlerController extends AppController {
case 'checkUser': return $this->checkUser($jsonData->email, $jsonData->last_name);
case 'getUsers' : return $this->getUsers($jsonData->page, $jsonData->limit);
case 'getUserBalance': return $this->getUserBalance($jsonData->email, $jsonData->last_name);
case 'errorInTransaction': return $this->errorInTransaction($jsonData->created, $jsonData->transactionGenericHash, $jsonData->error, $jsonData->errorMessage);
}
return $this->returnJson(['state' => 'error', 'msg' => 'unknown method for post', 'details' => $method]);
}
return $this->returnJson(['state' => 'error', 'msg' => 'no post or get']);
}
//! \param $transactionCreated creation of transaction in timestamp in seconds
//! -1 if transaction couldn't decode
//! \param $transactionBodyBase64Sha256 generic hash from transaction body serialized and converted to base64
//! using sodium_crypto_generichash to calculate
// hash also in base64 format
//! \param $error short error name in user language
//! \param $errorDetails more detailed error message in user language
private function errorInTransaction($transactionCreated, $transactionBodyBase64GenericHash, $error, $errorDetails) {
/*
* payload.set("created", created);
* payload.set("id", task_model->getID());
* payload.set("public_key", user_model->getPublicKeyHex());
* payload.set("error", error);
* payload.set("errorMessage", errorDetails);
*/
}
private function putTransaction($transactionBase64) {
$transaction = new Transaction($transactionBase64);

View File

@ -0,0 +1,16 @@
<?php $this->layout = false;?><!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>Visitor Page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div>Info Page for Visitor to learn about group before try to enter or connect (befriend)</div>
</body>
</html>