473,396 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Is user admin?

Hi ng,

I want to know if a user has admin rightsSo I wrote the following code
to check, if the user is in the admin-group:

Dim bIsInRole as Boolean
Dim myUser As Security.Principal.WindowsIdentity =
Principal.WindowsIdentity.GetCurrent()
Dim myPrincipal As New Principal.WindowsPrincipal(myUser)
bIsInRole =
myPrincipal.IsInRole(Principal.WindowsBuiltInRole. Administrator).ToString()
Works fine, but now I have another problem: If the User is not in
admin-group but in another group which belongs to the admins (or has
admin-rights), my code doesn't work.

Does anybody know how I can check if a group belongs to the admins?
Or does anybody know about another way to check, if a user has
admin-rights?

Thanx,
Norman

Dec 1 '06 #1
2 1589
What operation(s) do you want to perform ?

--
Patrice

"Norman Chong" <no*********@freenet.dea écrit dans le message de news:
11**********************@73g2000cwn.googlegroups.c om...
Hi ng,

I want to know if a user has admin rightsSo I wrote the following code
to check, if the user is in the admin-group:

Dim bIsInRole as Boolean
Dim myUser As Security.Principal.WindowsIdentity =
Principal.WindowsIdentity.GetCurrent()
Dim myPrincipal As New Principal.WindowsPrincipal(myUser)
bIsInRole =
myPrincipal.IsInRole(Principal.WindowsBuiltInRole. Administrator).ToString()
Works fine, but now I have another problem: If the User is not in
admin-group but in another group which belongs to the admins (or has
admin-rights), my code doesn't work.

Does anybody know how I can check if a group belongs to the admins?
Or does anybody know about another way to check, if a user has
admin-rights?

Thanx,
Norman

Dec 1 '06 #2
Patrice wrote:
What operation(s) do you want to perform ?
Hi Patrice,

I just want to check if my current user has admin rights to display a
'yes' or 'no' to the user. My application is a part of a setup for
another application which needs those rights, that's why I have to
check it.

Norman

Dec 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Guadala Harry | last post by:
Is there any way for one Session to remove and update objects in another Session? I seriously doubt it, but thought I'd ask. Here's why: I have some data that is unique per user (or per session -...
11
by: AnhTai | last post by:
Hi all, I've just installed MySQL 5.0 on my sun box (runing Solaris 10, install from blastwave). This is my first time with MySQL so I don't have any exp with it. I have some troubles as: -...
3
by: tshad | last post by:
I am playing with GenericPrincipal classes and am using a sample program to test it. The problem is that even though I set the roles (which shows the roles in the Context.User as being there),...
4
by: mrouleau | last post by:
I am sorry if this is the wrong group to ask, if so please point me in the correct direction. My problem is I have an MDB file with user-level security on it (mdw). When i move it over to a...
31
by: zdenko | last post by:
I have a multi user database and users were created by user level security wizzard - as I mentioned in message before. Everything works fine for those users, but now I have another problem. I have...
12
by: Hejman | last post by:
ok i had some problems before with imaging, but that is all solved. but now i need help with some user authentication. basically, when you add a user to my database, "busted" under table "user_info",...
2
by: gangac | last post by:
I am currently working on an ms access application for a large insurance company which generates reports for the user after the user inputs/select some data.... Unfortunately the application has...
4
by: Kerem Gümrükcü | last post by:
Hi, the topic of this thread implies the question. Why does this happen. What can i do against it. App runs in admin context, then ii switch to user standard user context and open a form with...
0
by: Big Charles | last post by:
Hello, Programming in VS2003-ASP.NET 1.1, I have this problem: Using DirectoryEntry and without any admin user, how can I check if a domain account, that try to login, has expired? Scenario: User...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.