zura katsitadze
zura katsitadze

Reputation: 317

JSF Primefaces and Spring security User Managment ROLE_USER and ROLE_ADMIN

I want to make simple user management. I have primefaces DataTables, when user is "ROLE_USER" I want to my DataTables not to be editable. But where user is ROLE_ADMIN I want my datatable to be editable.

I have properties in my ManagedBean

public boolean isAdmin;

When isAdmin is true I want datatable to be editable, if this is false then not editable.

I have solution but not working

<p:dataTable id="transactionTbl" var="tr"
value="#{reportParamManagedBean.reportsList}" rowKey="#{tr.id}"
editable="#{reportParamManagedBean.isAdmin}">

I have there error

Property 'isAdmin' not found on type MyBean

Please help, how to solve the problem?

Upvotes: 2

Views: 906

Answers (1)

rootkit
rootkit

Reputation: 2165

Add getter (and setter) in your bean:

private boolean isAdmin;

public boolean isAdmin() {
 return this.isAdmin;
}

public void setAdmin(boolean value) {
 this.isAdmin = value;
}

You probably have to retrieve the value as:

#{reportParamManagedBean.admin}

Upvotes: 2

Related Questions