Skip to content

Commit

Permalink
Entities Manager
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <[email protected]>
some more

Signed-off-by: Maxence Lange <[email protected]>
fixing stuff, better details

Signed-off-by: Maxence Lange <[email protected]>
still working on details

Signed-off-by: Maxence Lange <[email protected]>
details on members

Signed-off-by: Maxence Lange <[email protected]>
--short option

Signed-off-by: Maxence Lange <[email protected]>
create entities from command line

Signed-off-by: Maxence Lange <[email protected]>
cleaner way to check for owner

Signed-off-by: Maxence Lange <[email protected]>
search within accounts

Signed-off-by: Maxence Lange <[email protected]>
import displayName during migration

Signed-off-by: Maxence Lange <[email protected]>
display result in table

Signed-off-by: Maxence Lange <[email protected]>
admin right, some cleaning and sql logging

Signed-off-by: Maxence Lange <[email protected]>
add comments to sql log

Signed-off-by: Maxence Lange <[email protected]>
log exception from sql execution

Signed-off-by: Maxence Lange <[email protected]>
fixing and cleaning !

Signed-off-by: Maxence Lange <[email protected]>
fixing

Signed-off-by: Maxence Lange <[email protected]>
generate viewer and caching data

Signed-off-by: Maxence Lange <[email protected]>
cleaning

Signed-off-by: Maxence Lange <[email protected]>
limit visibility

Signed-off-by: Maxence Lange <[email protected]>
fixing default visibility on local user entity

Signed-off-by: Maxence Lange <[email protected]>
options and visibility level for admin

Signed-off-by: Maxence Lange <[email protected]>
better way to test EM

Signed-off-by: Maxence Lange <[email protected]>
new Session command

Signed-off-by: Maxence Lange <[email protected]>
nc-small-php-tools

Signed-off-by: Maxence Lange <[email protected]>
fix creation+deleteOn

Signed-off-by: Maxence Lange <[email protected]>
  • Loading branch information
ArtificialOwl committed Jun 21, 2019
1 parent 1ad95ca commit 4b79a8d
Show file tree
Hide file tree
Showing 76 changed files with 9,726 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 3rdparty
Submodule 3rdparty updated 1 files
+1 −0 composer.json
276 changes: 276 additions & 0 deletions core/Migrations/Version17000Date20190417091242.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
<?php
declare(strict_types=1);


/**
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <[email protected]>
* @copyright 2019, Maxence Lange <[email protected]>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/


namespace OC\Core\Migrations;


use Closure;
use Doctrine\DBAL\Types\Type;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;


/**
*
*/
class Version17000Date20190417091242 extends SimpleMigrationStep {


/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options
): ISchemaWrapper {

/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();


/**
* entities
*
* - id string - a unique uuid to ident the entity
* - type string - type of the entity: no_member, unique, group, admin_group
* - owner_id string - id from 'entitied_accounts' for the owner
* - visibility small int - visible to all, visible to owner only, visible to members
* - access small int - free, invite only, request needed
* - name string - name of the entity
* - creation datetime
*/
$table = $schema->createTable('entities');
$table->addColumn(
'id', Type::STRING,
[
'notnull' => true,
'length' => 11,
]
);
$table->addColumn(
'type', Type::STRING,
[
'notnull' => true,
'length' => 15
]
);
$table->addColumn(
'owner_id', Type::STRING,
[
'notnull' => true,
'length' => 11,
]
);
$table->addColumn(
'visibility', Type::SMALLINT,
[
'notnull' => true,
'length' => 1,
]
);
$table->addColumn(
'access', Type::SMALLINT,
[
'notnull' => true,
'length' => 1,
]
);
$table->addColumn(
'name', Type::STRING,
[
'notnull' => true,
'length' => 63
]
);
$table->addColumn(
'creation', Type::DATETIME,
[
'notnull' => true
]
);
$table->setPrimaryKey(['id']);


/**
* entities_accounts
*
* - id string - a unique uuid to ident the account
* - type string - local_user, mail_address, guest_user
* - account string - account/user_id
* - creation datetime
*/
$table = $schema->createTable('entities_accounts');
$table->addColumn(
'id', Type::STRING,
[
'notnull' => true,
'length' => 11,
]
);
$table->addColumn(
'type', Type::STRING,
[
'notnull' => true,
'length' => 15
]
);
$table->addColumn(
'account', Type::STRING,
[
'notnull' => true,
'length' => 127
]
);
$table->addColumn(
'delete_on', Type::INTEGER,
[
'notnull' => true,
'length' => 12
]
);
$table->addColumn(
'creation', Type::DATETIME,
[
'notnull' => true
]
);
$table->setPrimaryKey(['id']);


/**
* entities_members
*
* - id string - a unique uuid
* - entity_id string - id from 'entities'
* - account_id string - id from 'entities_accounts'
* - slave_entity_id string - id from 'entities'
* - status string - invited, requesting, member
* - level small int - 1=member, 4=moderator, 8=admin
* - creation datetime
*/
$table = $schema->createTable('entities_members');
$table->addColumn(
'id', Type::STRING,
[
'notnull' => true,
'length' => 11,
]
);
$table->addColumn(
'entity_id', Type::STRING,
[
'notnull' => true,
'length' => 11
]
);
$table->addColumn(
'account_id', Type::STRING,
[
'notnull' => false,
'length' => 11
]
);
$table->addColumn(
'slave_entity_id', Type::STRING,
[
'notnull' => false,
'length' => 11
]
);
$table->addColumn(
'status', Type::STRING,
[
'notnull' => true,
'length' => 15
]
);
$table->addColumn(
'level', Type::SMALLINT,
[
'notnull' => true,
'length' => 1,
'unsigned' => true
]
);
$table->addColumn(
'creation', Type::DATETIME,
[
'notnull' => true
]
);
$table->setPrimaryKey(['id']);


/**
* entities_types
*
* - id int - incremented and primary key, nothing more
* - type string - string that define the type
* - interface string - type of the type(sic)
* - class string - class to be called to manage the service
*/
$table = $schema->createTable('entities_types');
$table->addColumn(
'id', Type::INTEGER,
[
'autoincrement' => true,
'notnull' => true,
'length' => 3,
'unsigned' => true,
]
);
$table->addColumn(
'type', Type::STRING,
[
'notnull' => true,
'length' => 15
]
);
$table->addColumn(
'interface', Type::STRING,
[
'notnull' => true,
'length' => 31
]
);
$table->addColumn(
'class', Type::STRING,
[
'notnull' => true,
'length' => 127
]
);
$table->setPrimaryKey(['id']);


return $schema;
}
}
18 changes: 18 additions & 0 deletions core/register_command.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
*
*/


use OCP\AppFramework\QueryException;


/** @var $application Symfony\Component\Console\Application */
$application->add(new \Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand());
$application->add(new OC\Core\Command\Status);
Expand Down Expand Up @@ -166,6 +170,20 @@
$application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(null), \OC::$server->getL10N('core')));
$application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager(null)));
$application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager(null)));

try {
$application->add(new OC\Entities\Command\Create(OC::$server->getEntitiesManager(), OC::$server->getEntitiesHelper()));
$application->add(new OC\Entities\Command\Delete(OC::$server->getEntitiesManager(), OC::$server->getEntitiesHelper()));
$application->add(new OC\Entities\Command\Details(OC::$server->getEntitiesManager()));
$application->add(new OC\Entities\Command\Install(OC::$server->getEntitiesHelper()));
$application->add(new OC\Entities\Command\Migration(OC::$server->getEntitiesManager(), OC::$server->getEntitiesMigrationHelper()));
$application->add(new OC\Entities\Command\Modify(OC::$server->getEntitiesManager(), OC::$server->getEntitiesHelper()));
$application->add(new OC\Entities\Command\Search(OC::$server->getEntitiesHelper(), OC::$server->getEntitiesManager()));
$application->add(new OC\Entities\Command\Session(OC::$server->getEntitiesManager(), OC::$server->getEntitiesHelper()));
} catch (QueryException $e) {
OC::$server->getLogger()->log(3, 'QueryException while loading Entities/Commands: ' . $e->getMessage());
}

} else {
$application->add(new OC\Core\Command\Maintenance\Install(\OC::$server->getSystemConfig()));
}
Loading

0 comments on commit 4b79a8d

Please sign in to comment.