Macro visibility signature

John Sharp asked on October 11, 2017 16:54

I've added new functionality to an existing module to show a new tab on the Pages application using the following macro. The following is added to Modules -> Interface -> (choose a page) -> Element Restrictions -> Visibility condition: System.GetObject("cms.node",Convert.ToInt(QueryString.nodeid, 0)).NodeClass.ClassName == "SearchPageLocation"

Everything seems to be OK on our development platform and through Kentico itself, I can see the added element in the list, however packaging it up and putting it on the stage server causes an entry in the event log that the developer who created the macro is not on the stage server; I'm getting this: The expression was signed by user '<user>'. Remove the signature and re-save the expression by a user with proper permissions.

I've tried changing the macro to be wrapped with {% @%} but the {% and %} get trimmed leaving an invalid macro.

Any ideas how to "unsign" the macro or at least stop it the validation attempt?

Many thanks,

John

Correct Answer

Matt Nield answered on October 11, 2017 21:35

John, if it's just and individual macro causing the issue, you shoudl be able to re-save the macro with a user that has appropriate permissions to re-sign it. I'm sure you've read it, but there is the documenation for working with macro signatures available with the rest of the docs. you get a very short snippet that says:

To re-sign individual macros, find the expression in the user interface and save the value (you can use the macro report tool to find the location). The system creates a new signature for the macro based on the application's current environment.

As Rui says, you can resign all of the macros across the instance if the above does not work. If you're comfortable poking about in SQL, you also have the option of locating the individual sinature an obliterating it. It lives in the CMS_UIElement under the ElementVisbilityCOndition column. In my case, the macro I used was:

CurrentUser.IsInRole("reporting")

Which translated to

{%CurrentUser.IsInRole("reporting")|(identity)GlobalAdministrator%}

In there, I can modify/remove the signature and - for good measure - restart the application.

Do keep in mind the security note if you just re-sign all macros:

Security warning: With the Sign all macros option enabled, the resigning process also includes macros that are unsigned or have invalid signatures. If your system's data contains invalid macros added by users with insufficient authorization, such macros receive valid signatures and represent potential security threats.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Roman Hutnyk answered on October 11, 2017 17:06

Do you have user that signed the macro in staging? If no I'd recommend to stage it with content staging module.

As a quick fix you could navigate Modules -> Interface -> (choose a page) -> Element Restrictions and hit save - this should re-sign the macro.

2 votesVote for this answer Mark as a Correct answer

John Sharp answered on October 11, 2017 17:33

Hi Roman,

No, the user is only a developer-user and isn't on stage or live.

I'm not sure that the current setup we have supports those answers as we're not using content-staging from dev to stage and won't be from stage to live. And as the package have been wrapped up on dev and imported into Stage as a packaged module we there isn't a save option.

I have an option of Customize and then pressing Save but that doesn't feel like a proper solution.

John

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on October 11, 2017 17:40

You said the issue appears after putting it into staging - how do you move it there? - staging would be helpful here.

Have you tried re-signing the macro in staging?

0 votesVote for this answer Mark as a Correct answer

John Sharp answered on October 11, 2017 17:43

Hi Roman,

Yes, we package up the module using Import/Export and put it on the other server using Import; I'm doing it that way as it mirrors our process of putting files live. When the module is installed on the stage server the option of saving the module is not available directly.

John

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on October 11, 2017 19:41

Try to do a macro signature resigning for all by going to System app > Macro > Signature, check both boxes and resign all macros.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.