Firstly, I have to say I have recently joined the forums and I have learnt a great deal from this forum over the last month or so. Some excellent information and very helpful video tutorials !
I am after a bit of advice or a shove in the right direction. Basically, I am creating an application that has both manager and normal user roles. Only employees in the manager role are able to administer normal users, i.e. no users can add themselves to
the application. So far, Ive managed to customise the Create User Wizard with an additional step that allows managers to specify a role for the new user during their creation and all this is written to the ASPNETDB successfully. I can also login to the application
with different credentials and have been able to limit access to particular features based on user roles......thats the good part !
Now I want to create a page for managers to be able to work with the data in the ASPNETDB tables. In particular I want managers to be able to:
amend user details as appropriate, for example change their role
delete users from the table so they can no longer access the application if they leave the organisation
I have had a few unsuccessful attempts so far and would welcome any advice to help me get this function up and running !
amend user details as appropriate, for example change their role
delete users from the table so they can no longer access the application if they leave the organisation
Hello,
Most of the functionalities that you need starts with the MembershipAPI. Working with the user accounts are often accessed through the MembershipUser object. You can use something like:
MembershipUser mu = Membership.GetUser(); // this GetUser method has overloads for your convenience
Deleting a user is as simple as:
Membership.DeleteUser // you do the method parameter for this
if you want to change their role, you can use the Roles API (provided you are using the default Role Provider)
Roles.RemoveUserFromRole and Roles.AddUserToRole, etc.
Thank you very much for the replies. They've helped me to understand it a bit better , I'll take a closer look at the MembershipAPI and try to get it working.
gsr80
Member
8 Points
56 Posts
Modifying the ASPNETDB tables programmatically
Mar 25, 2009 11:52 AM|LINK
Hi everyone,
Firstly, I have to say I have recently joined the forums and I have learnt a great deal from this forum over the last month or so. Some excellent information and very helpful video tutorials !
I am after a bit of advice or a shove in the right direction. Basically, I am creating an application that has both manager and normal user roles. Only employees in the manager role are able to administer normal users, i.e. no users can add themselves to the application. So far, Ive managed to customise the Create User Wizard with an additional step that allows managers to specify a role for the new user during their creation and all this is written to the ASPNETDB successfully. I can also login to the application with different credentials and have been able to limit access to particular features based on user roles......thats the good part !
Now I want to create a page for managers to be able to work with the data in the ASPNETDB tables. In particular I want managers to be able to:
I have had a few unsuccessful attempts so far and would welcome any advice to help me get this function up and running !
Thanks very much
rrmacman
Contributor
2176 Points
475 Posts
Re: Modifying the ASPNETDB tables programmatically
Mar 25, 2009 05:26 PM|LINK
This website has good section on the membership class. Read http://www.asp.net/learn/security/ , it should help you out.
jpcoliveros
Contributor
2916 Points
419 Posts
MVP
Re: Modifying the ASPNETDB tables programmatically
Mar 25, 2009 11:07 PM|LINK
Hello,
Most of the functionalities that you need starts with the MembershipAPI. Working with the user accounts are often accessed through the MembershipUser object. You can use something like:
MembershipUser mu = Membership.GetUser(); // this GetUser method has overloads for your convenience
Deleting a user is as simple as:
Membership.DeleteUser // you do the method parameter for this
if you want to change their role, you can use the Roles API (provided you are using the default Role Provider)
Roles.RemoveUserFromRole and Roles.AddUserToRole, etc.
superpatrick.wordpress.com
gsr80
Member
8 Points
56 Posts
Re: Modifying the ASPNETDB tables programmatically
Mar 26, 2009 07:52 PM|LINK
Thank you very much for the replies. They've helped me to understand it a bit better , I'll take a closer look at the MembershipAPI and try to get it working.
Thanks again