[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    Re: going from loop component to grid + tapestry-security = hide columns for non-admin user & grid +
From:       Chris Mylonas <chris () opencsta ! org>
Date:       2014-04-16 14:25:24
Message-ID: CA+hnc4=-rAdDefUS4DC5RVPs7pCR-X1XE5TzdNMc68cP5wCMFA () mail ! gmail ! com
[Download RAW message or body]


Ah rowClass - I'll check that. Its past midnight and I'm about to retire
for the night.

As for binding to a parameter, I didn't think to do that in the page class.
I've been focussing on the template.  Will give it a shot next opportunity.

Thank for the quick suggestions, now I probably won't get to sleep!

Thanks
Chris
On 17/04/2014 12:13 am, "Chris Poulsen" <mailinglist@nesluop.dk> wrote:

> Hi.
> 
> Can't you bind the exclude parameter of the grid to a method that excludes
> extra columns, if the user is not logged in?
> 
> - And i think that you may be looking for rowClass parameter of the grid,
> not class.
> 
> I would suggest that you take a look at the documentation for the grid...
> 
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Grid.html
>  
> --
> Chris
> 
> 
> On Wed, Apr 16, 2014 at 3:52 PM, Chris Mylonas <chris@opencsta.org> wrote:
> 
> > Hi Tapsters,
> > 
> > I'm converting an old table with a t:Loop component into a t:Grid
> > component.
> > 
> > 
> > I used to have a table that hid the username/password columns and now
> for a
> > non-admin user with the grid the columns show.
> > You can see the code below.
> > 
> > Would I have to define the <t:grid ..............> inside a
> > <t:security.hasRole role="ADMIN"> block to get the desired effect of
> > showing the extra columns for admin users?
> > And have the <p:else> contain the grid excluding the username/password
> > columns?
> > 
> > 
> > 
> > The second problem is in my t:Loop component, the class was happily being
> > displayed as the ${currentNetworkInformation.status}  where inuse would
> be
> > css red and available would be css green.
> > However with the t:Grid component, the class =
> > ${currentNetworkInformation.status} is telling me it is null.
> > 
> > I can't use cycle, because I'm not really doing a zebra effect.  It's a
> > status based on the row value "effect"  *ta boom tish*
> > 
> > 
> > Any help on my two things would be great.  It's been a month between
> > tapestry development, the first 2 hours was spent re-installing my app
> > server and mucking around with t:parameter deprecation - not the most
> > useful 2 hours :P
> > 
> > 
> > Apart from my little grid problems, maybe I will stick with it - paging
> is
> > very very very handy on /19 subnets (thousands of ip addresses)!
> > Thanks
> > Chris
> > 
> > 
> > 
> > 
> > 
> > <tr t:type="Loop" t:source="assignedAddresses"
> > t:value="currentNetworkInformation"
> > class="${currentNetworkInformation.status}">
> > <td>${currentNetworkInformation.status}</td>
> > <td><a
> > href="ssh://${currentNetworkInformation.ipaddress}">SSH</a></td>
> > <td>${currentNetworkInformation.device}</td>
> > <td>${currentNetworkInformation.location}</td>
> > <t:security.hasRole role="ADMIN">
> > <td><t:pagelink page="admin/UpdateAddress"
> > 
> > 
> context="currentNetworkInformation.id">${currentNetworkInformation.ipaddress}</t:pagelink></td>
> 
> > <p:else>
> > <td>${currentNetworkInformation.ipaddress}</td>
> > </p:else>
> > </t:security.hasRole>
> > 
> > 
> > 
> <td>${subnetMaskEnumStringService.convertNetmask(currentNetworkInformation.mask)}</td>
> 
> > <td>${currentNetworkInformation.vlan}</td>
> > <td>${currentNetworkInformation.vrf}</td>
> > <td>${currentNetworkInformation.gateway}</td>
> > <t:security.hasRole role="ADMIN">
> > <td>${currentNetworkInformation.username}</td>
> > <td>${currentNetworkInformation.password}</td>
> > </t:security.hasRole>
> > </tr>
> > 
> > 
> > 
> > And I've moved to a grid.
> > 
> > <t:grid source="assignedAddresses" row="currentNetworkInformation"
> > add="login"
> > 
> > 
> exclude="id,_persistence_shouldRefreshFetchGroup,subnetId,addressType,OctetsInt1,OctetsInt2,OctetsInt3,OctetsInt4"
> 
> > 
> > 
> reorder="status,login,device,location,ipaddress,mask,vlan,vrf,gateway,username,password"
> 
> > rowsPerPage="256" class="${currentNetworkInformation.status}">
> > <p:loginCell>
> > <a href="ssh://${currentNetworkInformation.ipaddress}">SSH</a>
> > </p:loginCell>
> > <p:ipAddressCell>
> > <t:security.hasRole role="ADMIN">
> > <t:pagelink page="admin/UpdateAddress"
> > 
> > 
> context="currentNetworkInformation.id">${currentNetworkInformation.ipaddress}</t:pagelink>
> 
> > <p:else>
> > ${currentNetworkInformation.ipaddress}
> > </p:else>
> > </t:security.hasRole>
> > </p:ipAddressCell>
> > <p:usernameCell>
> > <t:security.hasRole role="ADMIN">
> > ${currentNetworkInformation.username}
> > </t:security.hasRole>
> > </p:usernameCell>
> > <p:passwordCell>
> > <t:security.hasRole role="ADMIN">
> > ${currentNetworkInformation.password}
> > </t:security.hasRole>
> > </p:passwordCell>
> > </t:grid>
> > 
> 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic