 |
| ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 23rd, 2011, 02:20 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Setting permissions for roles and users
Hello all,
We all create users and assign them to roles. But what is the method to create access rules for roles and users?
How we can create rules which should be applied to physical folders/pages as well as operations (CRUD) that are carriend out by site users?
Many thanks....
|
|

December 24th, 2011, 07:34 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
There is no standard API available. For your CRUD actions, you need to implement this yourself, executing different SQL for different users and roles.
To protect pages and other resources, you can use <location /> elements in your main web.config or in sub folder. You could create those programmatically by treating the web.config file as a simple XML file and add nodes to it. In addition, you can use the configuration API:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=102
http://stackoverflow.com/questions/2...th-c-sharp-net
https://www.google.com/#sclient=psy-...ogrammatically
Cheers,
Imar
|
|

December 24th, 2011, 01:01 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Hi Imar,
Thanks for reply,
Is there any resource or tutorial which can help in the direction for solving CRUD issues?
Many thanks...
|
|

December 26th, 2011, 05:28 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You can find a number of suggestions in Chapter 17 of my book where you see how to store the user's name with each new record, and use it later on to filter data.
If that's not helpful enough, I think you need to be more specific about what you want to accomplish and which data access technology you're using. There are many ways to do this, and what you need to do depends on how you're currently accessing the database.
Cheers,
Imar
|
|

December 27th, 2011, 03:51 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Hi Imar,
I am talking about CRUD operations for accessing and managing rules for roles and users, and I am using linq 2 ef in code behind without Stored Procedures.
Well I will check chapter 17 again if I can make it done. But can you suggest another resource particular to this problem.
Many thanks...
|
|

December 27th, 2011, 08:27 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Then look at the Membership and Roles classes. They expose (static) methods to manage users and roles, such as CrreateRole, GetUsersInRole and so on.
Cheers,
Imar
|
|

December 30th, 2011, 10:57 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Hi Imar,
I did not intend to ask to create/manage roles/users.
I asked for resources which deal in allowing admin of site through his admin area to set permissions for users and/or roles on the fly, remember admin does not have source code and is not technical.
It means say there is User A and Role B, now admin should be able to grant/deny permissions (mostly create/update/delete/select operations) and/or access to some area of site, through his admin panel.
Although you have said that "There is no standard API available. For your CRUD actions, you need to implement this yourself, executing different SQL for different users and roles. " but I am asking if you know some resource about what I have asked.
Many thanks...
|
|

January 4th, 2012, 09:40 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
but I am asking if you know some resource about what I have asked.
|
Nope, I don't. But I guess Google does have some useful stuff.
Cheers,
Imar
|
|
 |