• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Detect when a person has Submitted a Web App using Liquid?

Guide ,
May 03, 2016 May 03, 2016

Copy link to clipboard

Copied

I have a web app that allows anyone to edit the web app items, however, I only want certain users to be able to edit this web app. I have certain secure zones assigned to these users. I use module_data so I know what secure zones the user is subscribed to. I then can run the following logic:

{% if RescueVolunteer == 'True' or Director == 'True' or Admin == 'True' -%}

<!-- SHOW EDIT FORM -->

{% else -%}

     You do not have the necessary  permission to view this page. If this is an error, please contact us.

{% endif -%}

This works great but I've run into one issue. With this particular web app, for each item, we add the "Submitted By" field so the user will be able to edit this item. This particular user can only edit the web app item they are assigned to and are not assigned to one of the secure zones that has edit access.

Is there a way to detect, using liquid, when a user is assigned to the submitted by field? In other words, I want to be able to do this:

{% if SubmittedBy == 'True' -%}

SHOW FORM

{% endif -%}

I've checked the {{this | json}} but don't see anything that I could use. Is there something?

I've thought about adding the {module_webappcustomer} to the page to run logic but I haven't figured that one out yet.

Any guidance on how this can be achieved would be very much appreciated!

TOPICS
Developer

Views

547

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , May 03, 2016 May 03, 2016

Hi Lynda,

One solution we came up with several years ago, almost pre-liquid, but still relevant today, was to add in another field into the web app called "Submitted By", and this simply replicates the build in Submitted By functionality. Place the web app items owner's email address into this new custom field in order to manually verify if current logged in user has access to edit this current web app item.

It's barbaric, I know, but it works.

Stephen

Votes

Translate

Translate
Enthusiast ,
May 03, 2016 May 03, 2016

Copy link to clipboard

Copied

Hi Lynda,

One solution we came up with several years ago, almost pre-liquid, but still relevant today, was to add in another field into the web app called "Submitted By", and this simply replicates the build in Submitted By functionality. Place the web app items owner's email address into this new custom field in order to manually verify if current logged in user has access to edit this current web app item.

It's barbaric, I know, but it works.

Stephen

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 03, 2016 May 03, 2016

Copy link to clipboard

Copied

I think the "barbaric" solutions can sometimes be the best.

We already have a field for their email address so this would work.

Thank You!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 03, 2016 May 03, 2016

Copy link to clipboard

Copied

Lynda,

How do you have zone access?

A web app has an owner - Single Customer entry. You doing a shared login situation?

If not then you just use the default nature of the web app module only showing that persons owned web app items.

You just use that. And based on the actual web app settings in its configuration controls you can manage what those permissions are.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 03, 2016 May 03, 2016

Copy link to clipboard

Copied

Liam, the key to the question is "I have a web app that allows anyone to edit the web app items". Once anyone can edit a web app, meaning, not just their own items but all items, then all items become available to any logged in user. Yeah? So to lock it down, you then have to do it manually. If this isn't the case, I fail to see the point of the original question.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 03, 2016 May 03, 2016

Copy link to clipboard

Copied

But if your putting an option in so only the author can edit it, you may as well just do that and have your layout reflect if your showing all edit options or only the ones you can. Which you can do easily.
Either way would work but how I would do it would be a lot more streamlined and using native stuff as much as possible. I always try to do that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 04, 2016 May 04, 2016

Copy link to clipboard

Copied

LATEST

Sorry if I wasn't clear. I have four different secure zones, let's say: Level 1, Level 2, Level 3, Level 4

Anyone in the level 3 or 4 secure zone can edit the web app. In addition to those, I want to allow the web app author to edit the web app as well. The web app author may not be a member of level 3 or 4 secure zone thus they wouldn't have edit access to the web app.

With Stephen's solution I can still use Liquid to show/hide the form to those in level 3 or 4 AND the web app author. Works great!

I do agree that if there is a native way to do it, that is the best way. I just don't see a native way to do it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines