Jump to content
  • 0

Is It Possible To Display Records Depends On Role In An Authentication?


Cameron

Question

Hello everyone,

 

Happy New Year :)

 

I have a Gallery DataPage with Authentication. In the DataSource of the Authentication, there is the "Admin" checkbox.

I want to display the value of a field only if a user is admin and display a message, if a user is not admin.

 

I know, that it is a better to use two DataPages, but it is the only difference and I would like to use the same DataPage, if it's possible.

 

Is it possible?

 

Thank you for your time!

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi Cameron,

 

How are you?

 

I think, you can add an HTML Block to the Result page, disable an HTML Editor and enter the code like follows:

<script>
var checkbox='[@authfield:admin]';
var hiddenValue="You cannot see this information";
if (checkbox=="Yes") hiddenValue = '[@field:HiddenValue]';
var line = "<span class='cbResultSetLabel'>Name </span><span class='cbResultSetData'>"+hiddenValue+"</span>";
document.write(line);
</script>

Enter the name of you field in the Authentication DataSource instead of admin in the line "var checkbox='[@authfield:admin]';".

Enter your message instead of "You cannot see this information".

Enter the name of the field that contains value instead of HiddenValue in the line "if (checkbox=="Yes") hiddenValue = '[@field:HiddenValue]';"

 

But I'm not sure that it's a secure enough for you, JavaScript is not a secure instrument.

 

Have a good day!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...