-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WiP][ownCloud] Store full OCM payload (#58)
* add: store full ocm payload [initial support for #45] Signed-off-by: Mohammad Mahdi Baghbani Pourvahid <mahdi-baghbani@azadehafzar.io> * add: comments Signed-off-by: Mohammad Mahdi Baghbani Pourvahid <mahdi-baghbani@azadehafzar.io> * modify ocm payload schema and add initial flow document * docs: initial attempt at documenting app flow * fix: typo in table name * fix: syntax highlighting * refactor: result of code review with michiel changing controllers is still pending * add: store ocm payload for both sending/receiving shares * add: get server iop idp * add: do not allow same site sm shares reach reva at all * add: contact search json result * add: doc comment * fix: authenticate function to handle userid and token better --------- Signed-off-by: Mohammad Mahdi Baghbani Pourvahid <mahdi-baghbani@azadehafzar.io>
- Loading branch information
1 parent
8326266
commit 0e54681
Showing
12 changed files
with
1,733 additions
and
601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
<?php | ||
/** | ||
* ownCloud - sciencemesh | ||
* | ||
* This file is licensed under the MIT License. See the LICENCE file. | ||
* @license MIT | ||
* @copyright Sciencemesh 2020 - 2023 | ||
* | ||
* @author Mohammad Mahdi Baghbani Pourvahid <mahdi-baghbani@azadehafzar.ir> | ||
*/ | ||
|
||
namespace OCA\ScienceMesh\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use OCP\Migration\ISchemaMigration; | ||
|
||
/** Creates initial schema */ | ||
class Version20230916 implements ISchemaMigration | ||
{ | ||
public function changeSchema(Schema $schema, array $options) | ||
{ | ||
$prefix = $options["tablePrefix"]; | ||
|
||
// ocm_received_shares table. | ||
if (!$schema->hasTable("{$prefix}sciencemesh_ocm_received_shares")) { | ||
$table = $schema->createTable("{$prefix}sciencemesh_ocm_received_shares"); | ||
|
||
$table->addColumn("id", "bigint", [ | ||
"autoincrement" => true, | ||
"unsigned" => true, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("share_external_id", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("name", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
"comment" => "Original name on the remote server" | ||
]); | ||
|
||
$table->addColumn("share_with", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("owner", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("initiator", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("ctime", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("mtime", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("expiration", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => false, | ||
"default" => null, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("remote_share_id", "string", [ | ||
"length" => 255, | ||
"notnull" => false, | ||
"default" => null, | ||
"comment" => "share ID at the remote server" | ||
]); | ||
|
||
$table->setPrimaryKey(["id"]); | ||
|
||
$table->addUniqueIndex( | ||
["share_external_id"], | ||
"sm_ocm_rx_ex_id_idx" | ||
); | ||
$table->addUniqueIndex( | ||
["share_with"], | ||
"sm_ocm_rx_sh_w_idx" | ||
); | ||
} | ||
|
||
// ocm_protocol_transfer table. | ||
if (!$schema->hasTable("{$prefix}sciencemesh_ocm_received_share_protocol_transfer")) { | ||
$table = $schema->createTable("{$prefix}sciencemesh_ocm_received_share_protocol_transfer"); | ||
|
||
$table->addColumn("ocm_received_share_id", "bigint", [ | ||
"unsigned" => true, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("source_uri", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("shared_secret", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("size", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addUniqueIndex( | ||
["ocm_received_share_id"], | ||
"sm_ocm_rx_share_id_tx_idx" | ||
); | ||
} | ||
|
||
// ocm_protocol_webapp table. | ||
if (!$schema->hasTable("{$prefix}sciencemesh_ocm_received_share_protocol_webapp")) { | ||
$table = $schema->createTable("{$prefix}sciencemesh_ocm_received_share_protocol_webapp"); | ||
|
||
$table->addColumn("ocm_received_share_id", "bigint", [ | ||
"unsigned" => true, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("uri_template", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("view_mode", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addUniqueIndex( | ||
["ocm_received_share_id"], | ||
"sm_ocm_rx_share_id_app_idx" | ||
); | ||
} | ||
|
||
// ocm_protocol_webdav table. | ||
if (!$schema->hasTable("{$prefix}sciencemesh_ocm_received_share_protocol_webdav")) { | ||
$table = $schema->createTable("{$prefix}sciencemesh_ocm_received_share_protocol_webdav"); | ||
|
||
$table->addColumn("ocm_received_share_id", "bigint", [ | ||
"unsigned" => true, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("uri", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("shared_secret", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("permissions", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addUniqueIndex( | ||
["ocm_received_share_id"], | ||
"sm_ocm_rx_share_id_dav_idx" | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
<?php | ||
/** | ||
* ownCloud - sciencemesh | ||
* | ||
* This file is licensed under the MIT License. See the LICENCE file. | ||
* @license MIT | ||
* @copyright Sciencemesh 2020 - 2023 | ||
* | ||
* @author Mohammad Mahdi Baghbani Pourvahid <mahdi-baghbani@azadehafzar.ir> | ||
*/ | ||
|
||
namespace OCA\ScienceMesh\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use OCP\Migration\ISchemaMigration; | ||
|
||
/** Creates initial schema */ | ||
class Version20230917 implements ISchemaMigration | ||
{ | ||
public function changeSchema(Schema $schema, array $options) | ||
{ | ||
$prefix = $options["tablePrefix"]; | ||
|
||
// ocm_sent_shares table. | ||
if (!$schema->hasTable("{$prefix}sciencemesh_ocm_sent_shares")) { | ||
$table = $schema->createTable("{$prefix}sciencemesh_ocm_sent_shares"); | ||
|
||
$table->addColumn("id", "bigint", [ | ||
"autoincrement" => true, | ||
"unsigned" => true, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("share_internal_id", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("name", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
"comment" => "Original name on the sending server" | ||
]); | ||
|
||
$table->addColumn("share_with", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("owner", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("initiator", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("ctime", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("mtime", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("expiration", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => false, | ||
"default" => null, | ||
"length" => 11, | ||
]); | ||
|
||
$table->setPrimaryKey(["id"]); | ||
|
||
$table->addUniqueIndex( | ||
["share_internal_id"], | ||
"sm_ocm_tx_in_id_idx" | ||
); | ||
$table->addUniqueIndex( | ||
["share_with"], | ||
"sm_ocm_rx_sh_w_idx" | ||
); | ||
} | ||
|
||
// ocm_protocol_transfer table. | ||
if (!$schema->hasTable("{$prefix}sciencemesh_ocm_sent_share_protocol_transfer")) { | ||
$table = $schema->createTable("{$prefix}sciencemesh_ocm_sent_share_protocol_transfer"); | ||
|
||
$table->addColumn("ocm_sent_share_id", "bigint", [ | ||
"unsigned" => true, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("source_uri", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("shared_secret", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("size", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addUniqueIndex( | ||
["ocm_sent_share_id"], | ||
"sm_ocm_tx_share_id_tx_idx" | ||
); | ||
} | ||
|
||
// ocm_protocol_webapp table. | ||
if (!$schema->hasTable("{$prefix}sciencemesh_ocm_sent_share_protocol_webapp")) { | ||
$table = $schema->createTable("{$prefix}sciencemesh_ocm_sent_share_protocol_webapp"); | ||
|
||
$table->addColumn("ocm_sent_share_id", "bigint", [ | ||
"unsigned" => true, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("uri_template", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("view_mode", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addUniqueIndex( | ||
["ocm_sent_share_id"], | ||
"sm_ocm_tx_share_id_app_idx" | ||
); | ||
} | ||
|
||
// ocm_protocol_webdav table. | ||
if (!$schema->hasTable("{$prefix}sciencemesh_ocm_sent_share_protocol_webdav")) { | ||
$table = $schema->createTable("{$prefix}sciencemesh_ocm_sent_share_protocol_webdav"); | ||
|
||
$table->addColumn("ocm_sent_share_id", "bigint", [ | ||
"unsigned" => true, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addColumn("uri", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("shared_secret", "string", [ | ||
"length" => 255, | ||
"notnull" => true, | ||
]); | ||
|
||
$table->addColumn("permissions", "bigint", [ | ||
"unsigned" => false, | ||
"notnull" => true, | ||
"length" => 11, | ||
]); | ||
|
||
$table->addUniqueIndex( | ||
["ocm_sent_share_id"], | ||
"sm_ocm_tx_share_id_dav_idx" | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.