security using windowsprincipal class

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

I'm trying to get my application to authenticate using role based when the
user runs the application.

When the user logs on and is in the security group "school", the user gets
into the application no problem. But when the user is removed from the
group but doesnt log back in, he still has permissions to run the
application. This is also true if the user is already logged on and then
placed in the security group, the user cannot run the application. Is there
a way to make the application check Active Directory without logging in and
logging out for the permissions to take effect?

I need this to work because I cant iterate thru Active Directory to get the
nested security groups/roles of the user.

thanks in advance,
Will

Code:
Try

AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)

'get the current userid domain\username

Dim MyPrincipal As WindowsPrincipal = CType(Thread.CurrentPrincipal,
WindowsPrincipal)

winPrincipal = New WindowsPrincipal(MyPrincipal.Identity)

'get the current userid

userid = MyPrincipal.Identity.Name

Dim pp As New PrincipalPermission(userid, adrole)

pp.Demand()

'check if the user is part of the role to access this application

If winPrincipal.IsInRole(adrole) Then

'get the userid without the domain

userid = Mid(userid, InStr(userid, "\") + 1)

UserInfoClass.UserIdent = userid

Return True

Else

MsgBox("You do not have permission to run this program. Please see your
administrator.", MsgBoxStyle.Exclamation, "Access Error")

Return False

'Me.Close()

End If

Catch ex As Exception

MsgBox("Error:" & ex.Message)

Return False

End Try


.



Relevant Pages

  • Re: storedproc.edit: "select permission denied" when assigning to a field
    ... people who are concerned with security prefer NOT giving end users ... I think you're also suggesting that there be a single userid that everyone ... have other apps that do use them successfully. ... > you should be using a sql userid that has the correct permissions for the ...
    (borland.public.delphi.database.ado)
  • Using console.perms
    ... Assume you want to change owner of /dev/ttyS0 to user when user logs in. ... Otherwise it reverts to root. ... [root@k5di security]# more console.perms.d ... # This file determines the permissions that will be given to priviledged ...
    (Fedora)
  • RE: How to restrict users to see data in a mutiuser environment?
    ... interested setting up workgroup security. ... ' Gets the userid of the current user. ... Dim Length As Long ... which you open the form you want to filter. ...
    (microsoft.public.access.modulesdaovba)
  • Re: References for Brivo Systems Door Access Controls?
    ... I don't like the security ... happens when someone steals my userid and password? ... The panel is Internet connected and they connect to it ... you'd have to find some access control panels and some ...
    (alt.security.alarms)
  • RE: How to restrict users to see data in a mutiuser environment?
    ... ' Gets the userid of the current user. ... Dim Length As Long ... If you plan to use workgroup security, you could assign users to groups by ... which you open the form you want to filter. ...
    (microsoft.public.access.modulesdaovba)