Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
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
 
Old December 23rd, 2011, 02:20 PM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile 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....
 
Old December 24th, 2011, 07:34 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old December 24th, 2011, 01:01 PM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Hi Imar,
Thanks for reply,
Is there any resource or tutorial which can help in the direction for solving CRUD issues?
Many thanks...
 
Old December 26th, 2011, 05:28 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old December 27th, 2011, 03:51 AM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

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...
 
Old December 27th, 2011, 08:27 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old December 30th, 2011, 10:57 AM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

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...
 
Old January 4th, 2012, 09:40 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Roles, Permissions, and authentication. darwinfx Silverlight 4 2 June 28th, 2010 09:49 AM
roles and users in bugbase mrco BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 February 6th, 2007 12:32 PM
Roles Permissions Many to Many ... Why? seanmayhew BOOK: ASP.NET Website Programming Problem-Design-Solution 2 November 5th, 2004 10:51 AM
Chapter 6 - Roles/Permissions g_rhymes BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 3 June 28th, 2004 11:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.