Orchard Dynamic Forms Workflow not invoked - orchardcms

I made a simple workflow in Orchard 1.9.1 to notify when a dynamic forms is submitted.
I didn't set any prpoperty/data on the Start Activity so that it can capture all Dynamic Forms submission. However there seems an issue and the workflow is NOT being invoked.
I followed steps from here: http://docs.orchardproject.net/Documentation/Workflows
But this notify activity or may be even the start activity doesn't seem to be invoked/working . What More settings are required to get this workflow in action ?
Also, I have set the redirect URL in "Forms" element properties but the form isn't redirecting. What can be the issue here as well ?

I have not seen this problem with a workflow before. I assume there's nothing in the logs?
My first guess would be that it's your form that is not submitting properly, try to remove that redirect, also make sure there's isn't some validation error blocking it, if you placed recaptcha element remove it and try again.
Second guess which is not very likely is that you have somehow managed to hide notification zone, either with CSS or in layout view #Zone(Model.Messages)

Related

How to add custom logging to TrackJS

I have a page redirect happening on a certain page that I need to watch for in an angular 5 app. I need to get the url while it is happening. How / Where can I add such things in TrackJs. Which API should I be using
You'll either need to instrument the destination page and log the referrer so that you know the source, or add a hook before navigation occurs and check the destination.
For a hook, you'll need to know how the navigation happens: either a click, form post, or window.open. For each of these, you can add an eventListener to look for the event and log.
You'll utilize the standard TrackJS API to track() a custom error when the right event occurs.

With Liferay7, Can I change existed portal filter behavior, like AutoLoginFilter

After I opened Auto Login function for my portal, it worked very well. That I visited any page will cause an autologin trigger.
auto.login.hooks=acn.autologin.login.MyAutoLogin
But I hope "Auto Login" will be triggered only when I visited specified url. When I visited other urls, I will still login with a normal login page.
Is it possible to change url pattern of Auto Login filter?
I have done this kind of thing in liferay 6.2 by update servlet-filter definition in hook xml file. But liferay 7 seems not suggest to use this way to define filter and update exited filter. Please give me some advice.
https://dev.liferay.com/de/develop/tutorials/-/knowledge_base/7-0/auto-login
should give you the info about registering your autologins as a DS component
the filter hook is described in here
http://www.javasavvy.com/liferay-dxp-filter-tutorial/
remember everything is now hidden in #component Annotations
is it that what your searching for ?

Liferay - Intermediate page after login and landing

I am looking to have two factor authentication. That is after login, i want to show an intermediate page. Only after some action has been done on the second page, user is taken to the landing page.
I have logic for second factor authentication ready. Its basically a jsp with some action.
However I am not sure what is the right approach to insert this intermediate page.
I have seen terms of use page, wherein the flag is maintained in db and the code is there in actual implementation class. I dont want to use extension plugin to do this. So I ruled out that option.
Second way is to have a Service Pre Action hook and do the necessary check here. But when I place the code in here, it goes to infinite loop.
Any other way I can do this? Hook is my preference.
Second way is to have a Service Pre Action hook and do the necessary
check here. But when I place the code in here, it goes to infinite
loop.
Not sure why this would happen, may be you would need to add a check or a flag which would execute your code only if the second tier authentication fails else it should just normally run the ServicePreAction code.
Another way I can think of is to use a custom struts-action to show your JSP and do the desired action in the custom action class.
Hope this helps.
I have not checked how to achieve that, but my guess is that extending the login portlet in a hook is the best way.
you can store the redirection url, redirect to the intermediate page and then load the stored url.
Regards.

Liferay changing the default redirect page when a does not have the specific role

This is basically two question? First i was wonder how to change the page liferay redirects when a user tries to access a page that has Power User view permissions. Liferay by default points to localhost:web/guest/home where they have their login page. On my application i have a different login in page and i want to redirect to the following page. I was browsing the web and found out that by setting auth.login.site.url=/whereiwontittopoint should actualy redirect me there. However it does not. I'm using Liferay 6.0.6 Community Editions. Has anyone done this? Is this the right way or this need to be done with a hook?
My other question is the following. I want to have a custom role on some pages. And i want when a user does not have that specfic role to be redirect to a totaly different page not the default login. I'm fairly sure this can be done by using the hook on some service but for some reason i can not identify this service.
EDIT
Ok for the first question i solved the issues. For the second question the answers i got here were not what i was looking for probably because i didn't post the question correctly. This is a full scenario of what i have done and what i need to do:
First of all i changed the /web/guest path that's on every liferay page to web/somthing/ this might not play a crucial role but the problems(some of the problems) started when that happend. THe over all idea is the following. I'm using spring mvc to create the application. I have created a backend to my application from where the admin can create pages for other users to see(This is not done by going to the control panel of liferay and adding a page but through the logic of the application). Once a page is created depending on some logic i create a role for that certain page(customer role also through code not the liferay admin). Some of the users are given this role if the satisfy some criteria and some are not. Here my problem arises, once a user that is loged in to my application tries to access a page (by inputting a direct URL in the browser to the page) that requres the view permision of the role i create for that page and the user does not have the appropriate role he gets redirect to lets say localhost/web/(username)/home a personal page and for some reason on that page by default from liferay he is able to view personal data(user name) of all other users of the application. My question is how through code to handle the redirection that happens of the above scenario.
I have tried on one attempt to actualy hook the servlet.service.events.pre action and before the user access that page to check if he has the appropriate permisions and actualy change his request. So far i have some issues but i can resolve them but this approach is not what i not rly what i am looking for because this action is executed before every single request on the application( and the page handling is just small part of that application) which means i will have a lot of code executing for no reason. I was wondering if there are any ways to add where the exception will redirect when i create the role? If not what action should i hook that will help me solve this scenario but with out the unneeded extrea trafic that i am creating with hooking servlet.service.events.pre action?
For the second stuff a bit hacky way could be as follows
1) Define set of roles against which you want to check in portal-ext.properties. You can add some property like my.super.secret.roles=rolename1,rolename2
2) Add a property for a redirect page url in portal-ext.properties so that you can redirect user there.
3)Add a custom attribute for Layout named checkForSecretRoles which has to be boolean and visible on Page. This will show you a checkbox in Manage page for each page, so that an admin can easily check or uncheck the value
4)Add a condition in your theme (portal_normal.vm) to check if the page has a check for secret role and then check the users role falls in any of the roles defined in portal-ext.properties. If yes then issue a redirect to the page specified by your custom redirect page url property
For your first question, it should work -
auth.forward.last.paths=/sign-in
sign-in would be your page name
The answer for your second question is, you have to create a Hook extending Action and made the below entry in your portal-ext.properties.
login.events.post=com.liferay.portal.events.LoginPostAction,com.liferay.portal.events.CustomLandingPageAction
There is a lot of information you can found on forum about how to use this property.
for 1. set default.landing.page.path=/whereiwontittopoint in portal.properties, see Liferay Login page redirect
for 2. create a hook, set servlet.service.events.post=com.my.action.MyAction and impliment this action, at this point you can redirect user to another page.

Sharepoint : Event Receiver : Item Adding

Anybody used the "ItemAdding" method successfully in an Event Receiver in Sharepoint for validation?
I think it just can't work properly for validation purposes because it seems that :
You can't access the data you just
entered in a form
If you add an error message,
instead of displaying the form
back with your error, Sharepoint
display the big ugly error page.
Here's what I found so far on the web for the ItemAdding method :
http://www.sharepoint-tips.com/2006/09/synchronous-add-list-event-itemadding.html
http://www.moss2007.be/blogs/vandest/archive/2007/07/20/wss-3-0-event-handler-pre-event-cancelling-issues.aspx
http://www.synergyonline.com/blog/blog-moss/Lists/Posts/Post.aspx?ID=25
Anyway, if somebody successfully used that method, please tell me how because I think that it's just broken/missing something!
Thanks!
You can't use ItemAdding to perform that kind of "friendly" validation checking. If you set e.Cancel = true and set e.ErrorMessage, sharepoint will redirect you to the standard error page and display your message. You can't make it redirect back to your form page.
Rather than trying to hack the built in pages, you should use an infopath or aspx form bound to a content type. Infopath has built-in validation controls and with aspx forms you build yourself you can treat it like any web app and choose your own validation.
No easy way out here I'm afraid.
-Oisin
You can access data that was just added in the form. Look at properties.AfterProperties in the adding/updating event receivers.
An example would be properties.AfterProperties["Title"].
I agree that error handling is a little hard, but I recommend that you do validation in your event receivers in addition to having your UI do validation. If it is not a custom page, then you can add JavaScript to existing pages using a Content Editor Web Part to do the validation.

Resources