Hello,

has anyone successfully iterated over groupNames as suggested in filtered
resources wiki page?

Regards Mirko
-- 
Sent from my mobile
---------- Forwarded message ----------
From: "Mirko Friedenhagen" <[email protected]>
Date: Jan 4, 2013 5:13 PM
Subject: Problem with filtered resources
To: <[email protected]>

Hello,

I try to use freemarker templates with settings.xml (as in
http://wiki.jfrog.org/confluence/display/RTF/Filtered+Resources),
however the user's groupNames seem not to be iterable? (Groupnames are
from LDAP).

I have something like (my test user is member of 6 groups):

  <#list security.getCurrentUserGroupNames() as groupName>
    <activeProfile>${groupName}</activeProfile>
  </#list>

and this results in:

    <activeProfile>ONE_VALID_GROUPNAME</activeProfile>
    <activeProfile>${groupName}</activeProfile>
    <activeProfile>${groupName}</activeProfile>
    <activeProfile>${groupName}</activeProfile>
    <activeProfile>${groupName}</activeProfile>
    <activeProfile>${groupName}</activeProfile>

I tried something like:

  <#assign nGroups = security.getCurrentUserGroupNames()?size - 1/>
  <#list 0..nGroups as i>
    <activeProfile>${security.getCurrentUserGroupNames()[i]}</activeProfile>
  </#list>

and this this resulted in:

    <activeProfile>ONE_VALID_GROUPNAME</activeProfile>
    <activeProfile>${security.getCurrentUserGroupNames()[i]}</activeProfile>
    <activeProfile>${security.getCurrentUserGroupNames()[i]}</activeProfile>
    <activeProfile>${security.getCurrentUserGroupNames()[i]}</activeProfile>
    <activeProfile>${security.getCurrentUserGroupNames()[i]}</activeProfile>
    <activeProfile>${security.getCurrentUserGroupNames()[i]}</activeProfile>

When I try to access groupName in an <#if> I always get INVALID.REFs

  <#list security.getCurrentUserGroupNames() as groupName>
    <#if groupName == "I_DO_NOT_EXIST">
    <activeProfile>I_DO_NOT_EXIST</activeProfile>
    <#else/>
    <!-- hello -->
    </#if>
  </#list>

I get:

<!-- hello -->
${INVALID.REF}${INVALID.REF}${INVALID.REF}${INVALID.REF}${INVALID.REF}

Now I am quite puzzled what is going on, googling and looking at
stackoverflow did not help either. My user is member of 6 groups, so
at least this is correct :-). I played with <#assign groupNames =
security.getCurrentUserGroupNames()/> as well, did not help. Any hints
would be appreciated.

Regards Mirko
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Artifactory-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/artifactory-users

Reply via email to