Friday, June 15, 2012

Read Permission on Fields

Fields can be displayed or hidden based on the role of the user. For example, all users are allowed to view the Hire Date field in the Employees controller by default.

Hire Date is visible on the Employees grid view by default.

Let’s configure the field to only permit administrators to view the Hire Date field.

Start the Project Designer. In the Project Explorer, switch to Controllers tab. Double-click on Employees / Fields / HireDate field node.

Hire Date field in the Employees controller.

Change the “Read” Roles property:

Property New Value
“Read” Roles Administrators

Press OK to save the field. On the toolbar, click Browse to generate the application.

Log in as user/user123%. Navigate to the Employees page. The Hire Date column will not be present in the view.

When logged in as user, the Hire Date column is not visible in the grid.

Log out, and log in as admin/admin123%. The Hire Date column will be visible again.

When logged in as admin, the Hire Date column will be visible.

No comments:

You can find more about Code OnTime Generator, Data Aquarium Framework, and other great products here.


© 2010 Code OnTime LLC. Intelligent code generation software for ASP.NET. Visit us at http://codeontime.com