See some properties only for a group

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2013 05:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2013 07:25 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2013 11:43 AM
thanks for your reply. Yes, that is the goal of my request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2013 01:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2013 12:30 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2013 04:57 AM
Can you show an example?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2013 07:04 AM
Using Edit of a imaginary document type "mydoc:doc" which has only 2 properties (mydoc


Take a copy of the standard edit form template (share/WEB-INF/classes/alfresco/site-wescripts/org/alfresco/documentlibrary/forms)
Save it to your extensions directory and thenmodify the code at
<div id="${formId}-fields" class="form-fields"> <#list form.structure as item> <#if item.kind == "set"> <@formLib.renderSet set=item /> <#else> <@formLib.renderField field=form.fields[item.id] /> </#if> </#list> </div>
to read something like
<div id="${formId}-fields" class="form-fields"> <#list form.structure as item> <#if item.kind == "set"> <@formLib.renderSet set=item /> <#else> <#assign showMe = true > <#switch form.fields[item.id]> <#case "mydoc:prop1"> <#assign showMe = false> <#assign members = people.getMembers("prop1_group")> <#list members as m> <#if m.id == person.userid> <#assign showMe = true > <#break> </#if> </#list> <#break> <#case "mydoc:prop2"> <#assign showMe = false> <#assign members = people.getMembers("prop2_group")> <#list members as m> <#if m.name == person.properties.userName> <#assign showMe = true > <#break> </#if> </#list> <#break> </#switch> <#if showMe == true> <@formLib.renderField field=form.fields[item.id] /> </#if> </#if> </#list> </div>
Then in share config custom tell the forms engine to use your template for this document type which you do by adding the line
<edit-form template="../documentlibrary/forms/{your template name}"/>
in the edit form definition after the field-visibility tags.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2013 11:36 AM
<div class="form-field"> <#if form.mode == "view"> <div class="viewmode-field"> <#assign members = people.getMembers(people.getGroup("site_cs-documenti_SiteManager"))> <#list members as m> <#if m.id == person.userid> <span class="viewmode-label">${field.label?html}:</span> <span class="viewmode-value">${field.value?html}</span> <#break> </#if> </#list> </#if></div>
But it return an error:
2013-12-05 17:38:52,140 ERROR [freemarker.runtime] [http-80-71] Template processing error: "Expression people is undefined on line 4, column 36 in org/alfresco/components/form/controls/cs-property-visibility.ftl."
Expression people is undefined on line 4, column 36 in org/alfresco/components/form/controls/cs-property-visibility.ftl.
The problematic instruction:
———-
==> assignment: members=people.getMembers("ALFRESCO_ADMINISTRATORS") [on line 4, column 17 in org/alfresco/components/form/controls/cs-property-visibility.ftl]
in include "${field.control.template}" [on line 90, column 7 in org/alfresco/components/form/form.lib.ftl]
in user-directive renderField [on line 121, column 13 in org/alfresco/components/form/form.lib.ftl]
in user-directive formLib.renderSet [on line 23, column 16 in org/alfresco/components/form/form.get.html.ftl]
in user-directive formLib.renderFormContainer [on line 20, column 7 in org/alfresco/components/form/form.get.html.ftl]
———-
Java backtrace for programmers:
———-
freemarker.core.InvalidReferenceException: Expression people is undefined on line 4, column 36 in org/alfresco/components/form/controls/cs-property-visibility.ftl.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2013 07:22 PM
All I can suggest it confirm that people.getGroup() actually works as a stand alone and that people.getMembers doesn't. If that is the case then I can only suggest you raise another question on these forums for help, because at that stage your issue exceeds ny experience.
You could also try using people.getContainerGroups(). This works in Javascripts and will return a list of groups that the logged in user belongs to. You could then modfy the code I sent to check against the returned groups.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2013 10:13 AM
I tried to use people.getGroup(), but it returned the same error.
For the moment, I will use this code:
<#if user.lastName == "xxx">
However, I will try to resolve my problem.
Thanks for your replies.
