jeudi 15 septembre 2022

How to display same URL by hiding a specific data inside URL to two different users

I’m trying to display a particular URL to users which consists of three metrics(dashboards) where they are fetching the code from three separate code-files for each metric.Here we have two types of users - USER1 &USER2.USER2 should not have the access/ should not be able to see a particular metric out of three but still be able to access the same URL to see other two metrics. USER 1 should be able to access the same URL and be able to see all the three metrics. So, let’s assume that particular metric which USER2 is supposed to not see is Analytics_metric from file “Analytics_metric.html.erb”.I want to achieve this by using if statements to validate USER1 & USER 2 from watching the metrics inside same URL for example- URL :https:/example/metrics.

Here is the code which I’m using currently to display the URL link to both USERS (Not performing any operations here) -


<%# if USERS?%>
<%= a_link url:example/metrics do%>
Metrics dashboards //Title of link
<%=end%>

As we can see the current code is accessible by both USER1 & USER 2 in order to display all three metrics when they just click the URL. But we don’t want this to happen as USER2 is also able to see the Analytics_metric which should not be seen.

Aucun commentaire:

Enregistrer un commentaire