Skip to content

Conversation

@tahaalibra
Copy link
Contributor

Fixes: #579

Licence: AGPL

Description

OCA\Gallery\Environment::setTokenBasedEnv and OCA\Files_Sharing\Controllers\ShareController::showShare are updated to use the share 2.0
this helps as now there is no need to check with checkLinkItemExists, checkLinkItemIsValid and checkItemType.
Important changes

  • instead of array it now return an IShare Object
  • $shareManager (object of type OCP\Share\IManager) is used to get the object using token

Features

Does not alter any Feature

Caveats

  • this is my first PR for backend..So please review on how i put comments etc..there may be some silly mistakes

Tested on

  • Ubuntu14.04/Chrome

Todo

  • Unit tests
  • Use ShareManger->checkPassword($share, $password)
  • Make a decision regarding the loss of granularity when dealing with token problems

Reviewers

@oparoz @rullzer

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @oparoz to be a potential reviewer

@tahaalibra
Copy link
Contributor Author

again this is my first backend PR..so please take a code....i am open for suggestion 😄

$this->fromRootToFolder = $this->buildFromRootToFolder($this->sharedNodeId);

$this->folderName = $linkItem->getTarget();
$this->userId = $origShareOwnerId;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this may be wrong. There is a difference between the share owner and the file owner

Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind.. there was duplication in the code left over from refactoring

@oparoz
Copy link
Contributor

oparoz commented Mar 11, 2016

Thanks for this. I'll take a better look tomorrow and provide some feedback, but that looks pretty good :).

One thing though, try to configure your IDE so that you keep the formatting.

@oparoz
Copy link
Contributor

oparoz commented Mar 11, 2016

Also, Try to fix the tests as it gives a good indication of if things still work as expected.

/** @var IControllerMethodReflector */
protected $reflector;
/** @var IManager */
protected $shareManager;
Copy link
Contributor

Choose a reason for hiding this comment

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

Your identation seems off... tabs vs spaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes....i am correcting my ide settings. Also i am trying to update unit tests...

@oparoz
Copy link
Contributor

oparoz commented Mar 15, 2016

Added a todo list to the OP

@tahaalibra tahaalibra force-pushed the share_20 branch 4 times, most recently from 305ed51 to 470915f Compare March 16, 2016 16:20
self::invokePrivate($this->middleware, 'checkSession', [$share]);
}

public function testCheckPasswordAfterValidPasswordEntry() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unit test results in Error...can you help

Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed, I think this was just due to a typo in EnvCheckMiddleware

@tahaalibra
Copy link
Contributor Author

late night updates.....check if its working ok....

@oparoz
Copy link
Contributor

oparoz commented May 15, 2016

@tahaalibra - Will you have time to finish this at some point?

@tahaalibra
Copy link
Contributor Author

@oparoz as i remember the last issue was that IShare was missing setId, it has been fixed in owncloud/core#23526, i am not sure whats remaining, as i remember the tests where running ok on my laptop.... i am currently away from my laptop, if its ok could you test this is PR

@oparoz
Copy link
Contributor

oparoz commented May 16, 2016

There was the missing setId, but also a typo which made tests fail.
I'll check the tests in core to see if they've been updated, if not, we can keep the current tests and they can be fixed later.

@oparoz oparoz added this to the 9.2-next milestone May 31, 2016
@oparoz oparoz mentioned this pull request Jun 11, 2016
3 tasks
@oparoz
Copy link
Contributor

oparoz commented Jun 11, 2016

Replaced by #668

@oparoz oparoz closed this Jun 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants