How can we assign or revok permission to users on apllications through C#.NET?

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2009
Posts: 1
Reputation: ashok90 is an unknown quantity at this point 
Solved Threads: 0
ashok90 ashok90 is offline Offline
Newbie Poster

How can we assign or revok permission to users on apllications through C#.NET?

 
0
  #1
Sep 18th, 2009
How can we give permissions or revoke permissions on applications(i.e installed softwares) for a user via c#.net.
i have get the all uers list on the computer and also installed programs list but how can i change a user permissions in a way that he may not able to use some specific application like photoshop, corel draw.

Detailed Description of Problem
I have three users 'A' , 'B' and 'C' on my Computer (Standalone) . I want that Only User 'A' can use Photoshop and User 'B' can only use coreldraw. So how we can give permissions to User 'A' and 'B'. I want to do this programmaticaly through C#.NET.

please help me to solve this problem.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 903
Reputation: DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough 
Solved Threads: 144
DdoubleD DdoubleD is offline Offline
Posting Shark

Re: How can we assign or revok permission to users on apllications through C#.NET?

 
0
  #2
Sep 18th, 2009
Not sure how you would do that by registered application, but here is a good link/example code showing how to add/revoke privileges to particular directory for user. You could change it also to use the File class objects instead of the Directory objects if you desire. I know it's probably not exactly what you are looking for, but maybe a workaround if needed:

Security Access Control
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: How can we assign or revok permission to users on apllications through C#.NET?

 
0
  #3
Sep 18th, 2009
I can suggest to use AOP http://www.postsharp.org it helps very well...
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 903
Reputation: DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough 
Solved Threads: 144
DdoubleD DdoubleD is offline Offline
Posting Shark

Re: How can we assign or revok permission to users on apllications through C#.NET?

 
0
  #4
Sep 18th, 2009
I found this code, but havn't tried it. It shows how to revoke registry privilege for software application, and I think it might be more of what you are looking for.

  1.  
  2.  
  3. public static void RevokeRegKeyRights(RegistryKey regKey,
  4. NTAccount user,
  5. RegistryRights rightsFlags,
  6. InheritanceFlags inherFlags,
  7. PropagationFlags propFlags,
  8. AccessControlType actFlags)
  9. {
  10. RegistrySecurity regSecurity = regKey.GetAccessControl();
  11.  
  12. RegistryAccessRule rule = new RegistryAccessRule(user, rightsFlags, inherFlags,
  13. propFlags, actFlags);
  14. regSecurity.RemoveAccessRuleSpecific(rule);
  15.  
  16. regKey.SetAccessControl(regSecurity);
  17. }

I believe that if you call the above with the RegistryRights.ExecuteKey option, it should prevent that user from launching the application:

  1. NTAccount user = new NTAccount(@"WRKSTN\ST");
  2.  
  3. using (RegistryKey regKey = Registry.LocalMachine.OpenSubKey(
  4. @"SOFTWARE\MyCompany\MyApp"))
  5. {
  6. RevokeRegKeyRights(regKey, user, RegistryRights.ExecuteKey,
  7. InheritanceFlags.None, PropagationFlags.None,
  8. AccessControlType.Allow);
  9. }
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: How can we assign or revok permission to users on apllications through C#.NET?

 
0
  #5
Sep 18th, 2009
Sorry you need to apply permission on your developed application or another applications
In case of another applications, you may the one who has the administrative permission and when install log on the i.e. 'A' account and right click on the exe and run it as administrator enter your username and password and in installation progress say just for this user. (Just if the application supports that)
You need to disable some user permissions....
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,612
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 463
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: How can we assign or revok permission to users on apllications through C#.NET?

 
0
  #6
Sep 19th, 2009
You need to block a pogram execution instead of setting/resetting permission.
Failure is not fatal, but failure to change might be. - John Wooden
Reply With Quote Quick reply to this message  
Reply


Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC