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

Sharelink v2.1.0 uli - fixes #539 #759

Closed
wants to merge 3 commits into from

Conversation

uli-heller
Copy link

@uli-heller uli-heller commented Jan 29, 2021

For a public form, the link looks like this:

For a non-public form, the link looks like this:

Signed-off-by: Uli Heller <uli.heller@daemons-point.com>
Signed-off-by: Uli Heller <uli.heller@daemons-point.com>
Signed-off-by: Uli Heller <uli.heller@daemons-point.com>
@jotoeri
Copy link
Member

jotoeri commented Jan 30, 2021

Hey Uli,
thank you for giving a go on this and welcome as a contributor! 🎉

In the issue we talked about a redirect in case it is necessary, and i think this would be the better way to go than changing the public url. So the url won't change depending on a setting.
I would return a RedirectResponse in the page-controller if the form is not public and no user is logged in.
To generate the url, you can use the urlgenerator, which can give you the base-url. Probably one still needs to have a look, if it is necessary to include the index.php or not. Unfortunately i currently didn't find a way to generate the login url directly. Probably @skjnldsv has one?

This way is a bit more to understand now to implement it, but that shouldn't be too difficult. Do you want to take a look into this? If you have questions, just ask! 😉

Greets,
Jonas

// Does the user have access to form
if (!$this->formsService->hasUserAccess($form->getId())) {
return $this->provideTemplate(self::TEMPLATE_NOTFOUND);
}

https://docs.nextcloud.com/server/20/developer_manual/basics/controllers.html#redirects
https://docs.nextcloud.com/server/20/developer_manual/basics/routing.html#using-the-urlgenerator
https://github.com/nextcloud/server/blob/e32a14788c42923d99498d62e7e9cc9c79e87720/lib/public/IURLGenerator.php#L105

@jotoeri jotoeri added 2. developing Work in progress bug Something isn't working labels Jan 30, 2021
@jotoeri jotoeri added this to the 2.2 milestone Jan 30, 2021
@uli-heller
Copy link
Author

Thx, your proposal is clearly better. I'll look into this. Best regards, Uli

@jotoeri
Copy link
Member

jotoeri commented Jan 31, 2021

Hey Uli,

while playing around on some different redirect, i just found the route to use for this! 😄:tada:
There is a route called core.login.showLoginForm, which also takes up the parameter redirect_url.
So we can generate the linkToRoute() for route forms.page.goto_form with parameter hash and then pass the resulting url as parameter redirect_url to the linkToRoute() for route core.login.showLoginForm. This creates the full url for the redirect and no manual url-handling is necessary! 😍

Greets,
Jonas

https://github.com/nextcloud/server/blob/d1bdd1ceba961b0899f504f7417a5c23271c5391/core/routes.php#L54
https://github.com/nextcloud/server/blob/d1bdd1ceba961b0899f504f7417a5c23271c5391/core/Controller/LoginController.php#L152

@jotoeri
Copy link
Member

jotoeri commented Feb 23, 2021

@uli-heller Are you motivated to do it yourself or should i take over? 😉

@uli-heller
Copy link
Author

@jotoeri Hey Jonas, I fear I will not have time for this in the upcoming week(s). I'd really appreciate if you could take care of this. Thx! Best regards, Uli

@jotoeri
Copy link
Member

jotoeri commented Feb 24, 2021

It's in #539 now, merged with some other new redirect.

Greets! :)
Jonas

@jotoeri jotoeri closed this Feb 24, 2021
@uli-heller
Copy link
Author

Thx a lot, I'll verify the changes later on...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants