Skip to content
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

Migrate advanced external storage backends to new registration API [part 3] #18441

Merged
merged 10 commits into from
Sep 13, 2015

Conversation

RobinMcCorkell
Copy link
Member

This PR migrates the following external storage backends:

  • OpenStack Swift Object Storage/Rackspace
  • SMB_OC -> merge with SMB
  • SFTP_Key -> merge with SFTP

⚠️ Requires the JS changes from #18440 for the SFTP_Key changes, no merge yet. Also backend unit tests need fixing, they still assume SMB_OC and SFTP_Key exist. ⚠️

Please review @PVince81 @DeepDiver1975 @MorrisJobke @icewind1991

cc @jmaciasportela for an example of how registration works.

Replaces #18245

Robin McCorkell added 8 commits August 28, 2015 12:58
The Rackspace/OpenStack differences have been split into separate auth
mechanisms, with correct legacy migration
SMB_OC has been merged with SMB, via the identifier aliases mechanism.
Legacy migration is done to the Session Credentials password mechanism
The SFTP backend now supports public key authentication alongside
password authentication.
VisibilityTrait -> PermissionsTrait

PermissionsTrait stores two sets of data, $permissions and
$allowedPermissions (analogous to $visibility and $allowedVisibility of
VisibilityTrait). Each set is a map of user type ('admin' or 'personal')
to permissions (mounting permission, create permission).

The result is that a backend can now be restricted for creation, while
still allowing it to be mounted. This is useful for deprecating backends
or auth mechanisms, preventing new storages being created, while still
allowing existing storages to be mounted.
Backend and auth mechanism permissions are checked on storage creation,
both for personal storages and for admin storages
@RobinMcCorkell
Copy link
Member Author

The visibility stuff has been augmented to a proper permissions model, similar to UNIX ACLs. It allows the deprecated storages to still be mounted, but not to be created (by a user or by the admin).

@icewind1991
Copy link
Contributor

smb lost the "username as share" option

@icewind1991
Copy link
Contributor

code looks good otherwise, havent tested

@RobinMcCorkell
Copy link
Member Author

@icewind1991 SMB never had the 'Username as share' option, only SMB_OC (which still has it, for existing storages). It can be replicated by putting '$user' in the share field though.

@MorrisJobke MorrisJobke added this to the 8.2-current milestone Aug 29, 2015
@PVince81
Copy link
Contributor

Code looks good, needs testing

@ghost
Copy link

ghost commented Aug 30, 2015

🚀 Test PASSed.🚀
chuck

@scrutinizer-notifier
Copy link

A new inspection was created.

@RobinMcCorkell
Copy link
Member Author

Good thing I tested the legacy migration... All 3 backends now correctly migrate to the new system - OpenStack with the 'API Key' set becomes an OpenStack with Rackspace authentication, OpenStack without 'API Key' becomes OpenStack with OpenStack authentication, SMB_OC is migrated to SMB with Session credentials (the typo was with 'Username as share', which now also works correctly). SFTP_Key correctly migrates to SFTP with RSA Public Key authentication, and it works both before and after. Generation of RSA keys works too with the new authentication mechanism.

Please review @PVince81 @MorrisJobke @nickvergessen @DeepDiver1975 @icewind1991

* For user type constants, see BackendService::USER_*
* For permission constants, see BackendService::PERMISSION_*
*/
trait PermissionsTrait {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need such complex permissions ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly for deprecation capabilities. In the current example, we need a way to stop users creating SMB_OC (it's deprecated), but still mount and modify existing ones. Then, the admin might want to disable mounting certain storages, so that's removing the mount and create permissions.

Basically I thought: UNIX extended permissions are well designed, so lets just emulate that.

@karlitschek
Copy link
Contributor

looks good 👍

}

public function manipulateStorageConfig(StorageConfig &$storage) {
$auth = new RSACrypt();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inject this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a different RSACrypt object for each storage, so injection wouldn't work (there's also no Factory available)

@icewind1991
Copy link
Contributor

👍 otherwise

@RobinMcCorkell
Copy link
Member Author

Core and common external tests pass, and SFTP tests pass (except for two failures with SFTP, but they also occur on master). Everything works when tested manually, and two reviewers -> merge

RobinMcCorkell pushed a commit that referenced this pull request Sep 13, 2015
Migrate advanced external storage backends to new registration API [part 3]
@RobinMcCorkell RobinMcCorkell merged commit 0dc7181 into master Sep 13, 2015
@RobinMcCorkell RobinMcCorkell deleted the ext-backends.advanced branch September 13, 2015 18:38
@lock lock bot locked as resolved and limited conversation to collaborators Aug 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants