Forum Discussion

StanGromer's avatar
7 years ago

display first name / Email addresses for users

Hi all - Admittedly I am not the expert, and I'll let our developer Karthi fill in the details, but we are having trouble - We are attempting to build a component that would display specific users.  The issue we are running into is that this works absolutely fine for Admins, but anyone who is not an admin, it fails to display anything at all.  My assumption/guess is that this is related to only Admins being able to see this level of detail on a persons profile. 

Again, not a developer, but my assumption is the component we built is being ran based on local  user permissions vs. admin permissions, so how would we get around this to display it for all users who hit this page?

  • Hi Lithium team, 

    As Stan said earlier, we are running into an issue of a code works for Admin and not working for Non-admin users, Lets for Employee it doesn't work. It returns empty records or no values, Can you please help us?

    Following is the code snippet.

    <!-- MasterAnaplanner Users and their role is either Customer or Partner Macro -->
    <#macro masterAnaplannerUsers>
      <#local msg = "SELECT id, href, view_href, login, email, first_name, last_name, rank.name, avatar.profile, rank.simple_criteria.role.id FROM users WHERE roles.id = 't:Master Anaplanner Directory'" />
      <#local msgqry = executeLiQLQuery(msg) />
      <#if msgqry?size gt 0>
        <#local users = msgqry />
        <#list users as user>
          <#local userQuery = "SELECT name FROM roles WHERE users.id = '${user.id}'" />
          <#local userObject = executeLiQLQuery(userQuery) />
          <#if userObject?size gt 0>
            <#local roles = userObject />
              <#if roles?? && roles[0]??>
                <#list roles as role>
                  <#if role.name == "Customer" || role.name == "Partner">
                    <div class="col">
                      <div class="avatar-role">
                        <div class="avatar">
                          <a href="${getFieldValue(user.view_href)}">
                            <img src="${user.avatar.profile}" />
                          </a>
                        </div>
                        <div class="user-role">
                          <span>${role.name}</span>
                        </div>
                      </div>
                      <div class="user-name-email">
                        <div class="name">${user.login}</div>
                      </div>
                    </div>
                  </#if>
                </#list>
              </#if>
            </#if>
        </#list>
        </#if>
    </#macro>

     

      • karthikeyan's avatar
        karthikeyan
        Guide
        <#function getFieldValue field="" defaultValue="" > <#if field?? && field?has_content> <#return field!defaultValue /> <#else> <#return defaultValue /> ---------------------- <#assign apiVersion = "2.0" /> <#function executeLiQLQuery qry isCount=false charSet="UTF-8"> <#if isCount> <#return (rest(apiVersion, "/search?q=" + qry?url(charSet) + "&restapi.response_style=view").data.size)!0 /> <#else> <#return (rest(apiVersion, "/search?q=" + qry?url(charSet) + "&restapi.response_style=view").data.items)![] />