login ID in SOP portlet, advanced default not possible
To achieve the security in Portlets based on User Profile, datasource of the portlet must have token [SYS.USER_ID], so that user who is logging into the system will have information as per his profile.
Except the SOP Portlets which are Java Portlets, all portlets support the Token [SYS.USER_ID] i.e. this token gets resolved when SQL query runs, but this token was not resolving in SOP Portlets.
Now to capture the User info in SOP Portlets indirectly, I created a mandatory filter field in these Portlets which will capture the user_id of Loggin User, so we can use the token of this filter field in datasource and datasource will have information of the Logged in user.
But we cannot set the value of user_id in filter field as a default. User who is logged in, must have to click on the filter field button to have value in it.
So whenever user adds the portlet on dashboard he has to click on the filter to have value in it, but in case, user who is getting the portlet as a published one and cannot edit the preferences, then he is getting the value in filter field of user who is published it rather then logged in user.
In case of publishing the portlet, if user has access of editing the preferences then portlet on his page will display a message "Please edit the preferences for this portlet" rather than taking the value of user who published it in filter field.
Are there any other ways of retrieving the login User_id within a SOP portlet so we will not have to force the user to set the filter field to their own user?