Nestuite: Suitescript variable for logged in or not? - netsuite

I have a web store (Suitebuilder) and I've got a specific vendor that only wants us to show prices when a customer is logged in. All other vendors allow prices to be shown regardless. Is there a suitescript variable that lets me know whether someone is logged in that I can use to customize a template based on a specific vendor and whether someone is logged in?

Not sure but below are some approaches
var isLoggedIn = "<%=getCurrentAttribute('customer','entityid')%>" != "";
You can check for the logged in customer email in your script to confirm whether is there any actual login or not.
Also you can try nlapiGetLogin if you're using any suitelets for custom login functionality
nlapiGetLogin()
Returns the NetSuite login credentials of currently logged-in user.
This API is supported in user event, portlet, Suitelet, RESTlet, and SSP scripts. For information about the unit cost associated with this API, see API Governance.
Returns nlobjLogin
var login = nlapiGetLogin(); //Get credentials of currently logged-in user
If you are using more like a SSP application then probably you can try this out
<%
var shoppingSession = nlapiGetWebContainer().getShoppingSession();
%>

You could try detecting a cookie, then alter the page layout using JS or CSS to show different prices. I don't know them off hand, but there are Cookie values that let you know when a customer is logged in.
There may also be some URL parameters you could detect, but I can't remember them.

Related

I need retrive WEB Account instead of SYSTEM user

Into spotfire, I need identify the user who is logged in the web browser not the system user.
What variable I can use ?
This is the script I use for the SYSTEM user
from System import Environment
Document.Properties['userName'] = Environment.UserName
Show web user in a variable
You can use %CURRENT_USER% in information links. I only say this because usually when people want to know who is logged in, it's to limit the data that's being returned based off what the user can see. This is called Personalized Information Links.
For scripting, you can use this:
from System.Threading import Thread
print Thread.CurrentPrincipal.Identity.Name

Detect internal order/created in administration

We have built a custom payment provider, see http://pmc.digital/pt/blogue/junho-2016/integracao-mb-way-com-kentico-cms/ (PT only sorry, see https://translate.google.com/translate?hl=en&sl=pt&tl=en&u=http%3A%2F%2Fpmc.digital%2Fpt%2Fblogue%2Fjunho-2016%2Fintegracao-mb-way-com-kentico-cms%2F for Google Translated version).
It works great, including with internal orders by site editors, however because the visitor (on the front-end) needs to be redirected to a "Pending Order Page" (with instructions to accept the payment in the provider's APP), it is also redirecting users in admin.
I was hoping to have a ViewMode for the administration, however when doing an internal order the PortalContext.ViewMode is live site (I guess so it can use the Shopping Cart steps/methods, etc).
Is it enough to check whether the current logged in user is not the user for the cart, and has the necessary permissions to the ecommerce module?
Considering usability what's the best method to redirect to the Orders APP from the CMSPaymentGatewayProvider ProcessPayment method?
You can use the following as well:
if(!string.IsNullOrEmpty(DocumentContext.CurrentAliasPath))
{
//do front end code
}
else
{
//do back end code
}
I have this running in a custom payment gateway with no issues at all.
The page that is used for creating new orders via administration interface has following url:
/CMSModules/Ecommerce/Pages/Tools/Orders/Order_New.aspx
So you can either check if the order is placing through this page or you can customize it and set some custom variable that would tell where you are placing the order.
If you want to get redirected to man Orders application, then the url is:
/Admin/CMSAdministration.aspx#b72ad042-31bf-4ff2-8436-25a647bba548
If you want just the grid of orders, then this is the url you are looking for:
/CMSModules/Ecommerce/Pages/Tools/Orders/Order_List.aspx

Hide querystring in url using MVC 5

Hi i have this application that needs a user to login.
Once the user is logged in, he is redirected to a page displaying documents for that user.
To display that information, I call the correct action on the controller and i pass my user-object. This object contains username and password.
When i look at my url it looks like :
http://localhost:53703/Documents?UserName=bart&UserId=10&Password=AllPhi%242015
Is there a way that I can hide those querystring-values (UserName=bart&UserId=10&Password=AllPhi%242015)
I can not object strongly enough to sidestepping the built in auth-mechanisms, but to answer the question: You cannot hide the query-string.
If you want to hide data when you are sending from a client you need to do a post request instead of a get, but the post-data is still visible in the request (in plain text)
But in this case it seems you want to pass data between actions, and then you want to use tempdata. Look here for reference: http://rachelappel.com/when-to-use-viewbag-viewdata-or-tempdata-in-asp.net-mvc-3-applications

Specifying which Google account to use when executing a Google Apps Script webapp request

I have a browser extension which is scraping the threadId from the URL when the user is reading an email in Gmail, and is using this threadId to fetch circumstantial data using the Google Apps Script API.
The extension do however not know which of maybe several Google accounts are reading this message; it knows only the URL to my Apps Script webapp and the threadId. So when it executes the fetch, the webapp will the interpret request as coming from the default user session, which in some cases is wrong and will thus result in an null when executing GmailApp.getThreadById(e.parameter.threadId).
So what I am wondering is whether it is possible to specify what Google account to use when querying the webapp. Are there any possibilities other than asking the user to log off all other accounts and set the current one as default?
Unfortunately Google Apps Script does not have good support for multiple logins. See this page for more information.
You can add an authuser parameters to the requests you make to your the Google Apps script.
The authuser param's values are zero based indexes for all the Google accounts that are logged in the current browser session.
Now for extracting what index value you need to send, you can scrape the current page for profiles.google.com links that have authuser param and extract your value from them and send it with your requests.
The link might look like this:
https://profiles.google.com/ ... authuser=0
Specifically for gmail, the url also contains the current authuser index, For example:
https://mail.google.com/mail/u/1/#inbox
This URL above contains the authuser value 1 at the end (before the fragment and after /u/)
I know this is very complex and is looks more like a hack. But I think this surely is a workaround, until Google provides a better way to specifying the context for your apps script requests.
I hope this might be helpful.
Thanks.

How to programmatically check view permission to a url in SharePoint?

I am displaying a list of popular public bookmarks to the logged-in user. Some users dont have access to these bookmark-urls and I want to suppress the results so that only accessible urls are shown to the user.
I tried to use the DoesUserHavePermissions method, but the problem is that I am not sure what object does the url points to (item/list/web/site).
I figured it out :|
when getting popular bookmarks from SocialTagManager i need to pass the logged-in users context i.e. SPServiceContext.Current and SharePoint will take care of the rest.

Resources