-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Central membership and group table #29107
Conversation
2059e50
to
f3dc66e
Compare
lib/private/Group/GroupEntity.php
Outdated
} | ||
|
||
return \OC::$server->getGroupManager()->getBackend($backendClass); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will we support a displayname as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it requirement for LDAP?
a2d2fdf
to
8c6131d
Compare
9540ea0
to
84340ed
Compare
lib/private/Group/BackendGroup.php
Outdated
*/ | ||
class BackendGroup extends Entity { | ||
|
||
protected $groupId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? the table has id, group_id, display_name and backend
I intend to add a uuid column because group_id is more like a group_name. groups might be renamed. Display name is different, typically being more verbose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think because the entity class handles these properties for you. Not that you don't need a groupId
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the entity only handles id
, group_id is something different. a lot of the other things could be removed though.
lib/private/Group/BackendGroup.php
Outdated
class BackendGroup extends Entity { | ||
|
||
protected $groupId; | ||
protected $displayName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
lib/private/Group/BackendGroup.php
Outdated
|
||
protected $groupId; | ||
protected $displayName; | ||
protected $backend; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phpdoc missing
|
||
//TODO: Do it later since it requires changes here for Oracle https://github.com/owncloud/core/blob/master/lib/private/DB/OracleMigrator.php#L158-L160 | ||
// Add foreign keys on backend_group and accounts tables | ||
//$table->addForeignKeyConstraint("{$prefix}backend_groups",array('backend_group_id'), array('id')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add right away
'notnull' => true, | ||
'length' => 64, | ||
]); | ||
$table->setPrimaryKey(['id']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no further indexes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not decide on it yet.
tests/lib/Group/GroupMapperTest.php
Outdated
} | ||
|
||
public static function tearDownAfterClass () { | ||
\OC::$server->getDatabaseConnection()->rollBack(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see - hmmmm - does this work?
tests/lib/Group/GroupMapperTest.php
Outdated
*/ | ||
public function testGet() { | ||
$result = $this->mapper->getGroup("TestFind1"); | ||
$this->assertInstanceOf("OC\Group\BackendGroup", $result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BackendGroup::class
tests/lib/Group/GroupMapperTest.php
Outdated
$backendGroup->setDisplayName("TestFind5"); | ||
$backendGroup->setBackend(self::class); | ||
|
||
$mapper = \OC::$server->getGroupMapper(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use this->mapper
version.php
Outdated
|
||
// The human readable string | ||
$OC_VersionString = '10.0.3'; | ||
$OC_VersionString = '10.0.4'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no - keep 10.0.3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if you change the schema, you need to increment version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the version string but oc_version
version.php
Outdated
@@ -25,10 +25,10 @@ | |||
// We only can count up. The 4. digit is only for the internal patchlevel to trigger DB upgrades | |||
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel | |||
// when updating major/minor version number. | |||
$OC_Version = [10, 0, 3, 3]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no - 10.0.3.4
tests/lib/DB/MigratorTest.php
Outdated
$migrator->migrate($startSchema); | ||
$migrator->migrate($startFKSchema); | ||
|
||
$this->assertTrue(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should assert that the fk was set
lib/private/DB/OracleMigrator.php
Outdated
return $this->quoteIndex($index); | ||
}, $tableDiff->addedForeignKeys); | ||
|
||
$tableDiff->changedForeignKeys = array_map(function(Index $index) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ForeignKeyConstraint not Index
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes, sorry
0bad371
to
4caa4fc
Compare
foreign key pr is merged to master - please rebase - THX |
One of the approaches proposed in #29154 |
lib/private/Server.php
Outdated
@@ -232,13 +233,16 @@ public function __construct($webRoot, \OC\Config $config) { | |||
$this->registerService('AccountMapper', function(Server $c) { | |||
return new AccountMapper($c->getConfig(), $c->getDatabaseConnection(), new AccountTermMapper($c->getDatabaseConnection())); | |||
}); | |||
$this->registerService('GroupMapper', function(Server $c) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should be here. The groupMapper isn't intended to be used isolated and it will depend on the groupManager.
I guess we can let it pass because the accountMapper is also exposed...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not exposed because as per definition developers are only allowed to work on interface which are in the OCP namespace.
* may be subject to change in the future | ||
* @since 10.0.0 | ||
*/ | ||
abstract class Access { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure of the purpose of this class... maybe it's the name what doesn't fit...
Just some personal recommendations to recheck:
- Make sure the purpose of this class is clear. This implies that only the specific methods to fufill its purpose should be there.
- Make sure the abstract class has clear extension points, and evaluate how subclasses will complete this abstract class.
I guess this second point is what bothers me: abstract classes should have at least an abstract method that subclasses should implement. This isn't the case here.
Inheritance doesn't seem the way to go in this case. I'd rather use composition: just create the "Access" class and inject it wherever its needed.
tests/lib/Group/GroupMapperTest.php
Outdated
parent::setUpBeforeClass(); | ||
$mapper = \OC::$server->getGroupMapper(); | ||
|
||
\OC::$server->getDatabaseConnection()->beginTransaction(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a comment to make sure the trick won't be forgotten, otherwise it's quite weird that you have one transaction hanging around.
…d, and only allow memberships to be synced on login
@PVince81 @DeepDiver1975 @butonic @tomneedham I have been on the customgroups and guest, and I can see that they will need sync on login also.. thus I remove the requirement of the flag isSyncMaintained. LDAP will work out of the box with this PR since all the things will be synced on user login. Custom Groups also works, but will require small adjustment to work better |
Updated the checklist for the discussions later if we want to go the direction proposed here. |
lots of conflicts, PR needs reviving |
@PVince81 I will resolve the conflicts and summarize advantages of this solution and disadvantages - last time I posted a report was in March (https://cloud.owncloud.com/index.php/s/eUajBR59vQNUEq1#pdfviewer), and there was no review. But by then central accounts were also fresh |
As discussed in #35777 the master branch will from now on hold the ownCloud 10 codebase. This PR targetted ownCloud 11 which is postponed to a far distant future. Because of that I'm closing this PR and kindly ask you to re-submit this PR in a few days. Thanks a lot for your patience |
Related Issue
fixes #27623
Plan
Types of changes
Checklist:
How to test it:
Main feature:
Main sync feature:
Main changes:
Required changes:
Tests: