DirectoryNotificationControl not notifying certain changes? - c#

I'm writing a C# application that monitors Active Directory for certain changes, and synchronize those to another system. I'm using System.DirectoryServices.Protocols.DirectoryNotificationControl from C# for this purpose so I don't have to poll AD for changes.
Works well in most scenarios. If I edit the user and adds the user to a group, I get notified. But if I edit a group and add a user to that group, I'm not notified about the user change. I'm notified about the group change though, but then I have to scan the groups members and maintain a crosscheck list and compare. Which doesn't scale.
Any ideas on how I can get notified more precisely about group membership changes in Active Directory?
Cheers,
Christian

Group membership is stored on the group. There is no modification to the user when you add them to a group. The display of group membership on the properties of the user is an abstraction via the memberOf attribute which is calculated on the fly when requested.

Full agree with #Brian Desmond, you can find the source information of what he is talking about in User Security Attributes Microsoft article (look for memberof). You can also read that you can get more informations in connecting to a Global Catalog
WMI is perhaps a second solution you can dig in.It exists AD WMI Providers. Using WMI to Monitor AD gives you some clues about that. This article don't do more than what you get so far, but I think that with WMI events you can create the notifications you need. You can find Microsoft informations about this begining in Monitoring Active Directory Health, especialy Active Directory WMI Providers.

Related

Membership App/Unity/Firebase: allow admins to write to other user nodes

I'm really at a loss here, and I cannot seem to find any information at all regarding this...
I'm putting together a membership management app for my coach's jiu jitsu gym using Unity and Firebase. Gym members can check in using the app and keep track of class schedules.
I want the admins, such as my coach (the gym owner) to be able to change values of the members information, such as if a membership fee isn't paid or if a liability waiver has expired. This way the member can see on their app if they are paid in full.
I cannot, for the life of me, find any instructions as to how to achieve this, nor can I seem to simply override it in the Firebase console. Is there any method for allowing an admin user to write to other user accounts?
What you're looking for is some form of Access Control.
Option 1
As #ltapox points out: maintain a list of users with elevated rights in RTDB. You can query against those values in your Security Rules.
Option 2
Set Custom Claims in Firebase Auth. This has to be done on the server, and basically adds custom properties to the Firebase Auth object of a user. You then have access to these properties in your Security Rules (see docs here) and on the client (docs).
Of the two options, I would recommend option 2 even so it's more effort. The benefit on the client is you know what type a user is by just looking at their Auth object, without querying RTDB.

Restrict user from adding some Active Directory DLs to SharePoint Site Permissions?

Is there any way to restrict a user from adding some specific Active directory DLs to SharePoint - 2013 Site permissions?
Does SharePoint fire an event while adding users/DLs to group, for which an event receiver can be written?
Or can it be achieved using SharePoint's App Model?
If not, please suggest me on how to achieve it either using code or using configuration?
Yes, you can restrict people picker to only certain organisation units from Active Directory either on farm level or on zone level. Please have a look on msdn and specifically on Peoplepicker-distributionlistsearchdomains

Getting Active directory users in Sharepoint 2010

How can we take the user's details from active directory in SharePoint 2010. I have one requirement, which has the functionality to send the mail to all the users who are listed in particular column in share point list. These column has the type of Single line of text (displaying display-name of the User). I need to retrieve each users information from AD by passing this display name without adding any LDAP connection string anywhere. Is it possible? if it possible, please help me to sort out this issue.
In my opinion the best way to achieve this is to use User Profile Synchronization. First you will need to configure user profile synchronization with AD. Then you can use SharePoint API (UserProfileManager class of server object model) to access user properties imported from AD.

Authenticating against Active Directory Group

I created a website using HTML/CSS to display a SQL reports index. This has worked fine up till now because users needed access to a security group and something inside SQL to view the report and the data fields. We are now getting to the stage where there are too many reports and some have sensitive names so we need to limit access based on Active Directory security groups. Thing is that I have no clue at all how to manage access via AD Groups. I have managed to get basic AD authentication working for another project that I deployed for the company, but that didn't require access beyond Domain Users.
Could anyone please point me in the right direction to authenticate via AD, check a user for groups and then display info based on their access. The last bit should be really easy, the hardest part will be checking group info and then filling a variable that I can then use to create a loop that will display all the reports the user has access to.
I have found a partial answer. The below link is a guide on how to pull all AD groups a user belongs to and then checking to see if they are a member of a certain group. This is largely what I was looking for and if I can meld it into what I want, I think I can use this to do what I need.
http://www.c-sharpcorner.com/UploadFile/scottlysle/test-for-user-group-membership-in-Asp-Net-C-Sharp/
Alternatively Microsoft windows server can also run LDAP which has an unbelievable number of compatible libraries to code with.
tutorial linked, its just another server role/feature you can install (like ad itself)
http://osqa.sjsoft.com/questions/248/how-do-i-install-minimal-active-directoryldap-services-on-windows-server-2008
also here is a Q.A.D SO answer to querying user-groups are you using windows framework like asp? whats your server technology?
Query From LDAP for User Groups

Search for a particular SharePoint user programmatically

I've an InfoPath form that the filler needs to specify people. A workflow later assigns tasks to these people. What I'm looking for is a people picker like what SharePoint has for user fields, but that I can use in InfoPath. I've already designed a form to do this where the filler can put in a name or email and the form will list results from the site.allusers group.
The problem is, what if the person that needs to be added into the form has never accessed this particular site collection before. Their account isn't going to be listed in the AllUsers list.
Where in the object model can I search for a user that is able to authenticate with SharePoint?
Why not just use the OTB one in InfoPath and configure it to point to your SharePoint environment?
http://www.sharepointassist.com/2009/02/27/adding-a-contact-selectorpeople-picker-to-an-infopath-form/
If your running MOSS with AD integration, then it should automatically retrieve everyone that's in your domain if AD synch is enabled.
I think that the problem here is that even if you do find a list of users, the workflows won't trigger any actions if the users don't exist in the User Information List.
If the users don't exist in the User Information List, then you won't be able to find them via the SharePoint object model because they don't exist in SharePoint. You will have to find them some other way.
So basically, it depends on how the authentication is configured on your SharePoint server :
If you are using FBA, then the users who can authenticate with SharePoint must exist in a SQL database somewhere. Membership.Provider will give you a hook on your FBA membership provider (whether it's a SqlMembershipProvider or something else). You can then use methods like
Membership.Provider.GetUser(username)
to see if a user exists. You can also loop through your users or find all the existing usernames which you could then display in your people picker.
If you are using windows authentication, you will have to look in your AD to find the potential users. The DirectoryEntry object is what you'll need. I imagine that only users from a certain AD group can access SharePoint? If so, then isolate that group with the DirectoryEntry object, loop through the users and you will have your data source for the people picker.
As I said above though, either method will give you the possible users, but it won't make the workflow work if the users have not logged in. Workflows will only work properly with users that do exist in the User Information List.
When someone picks a user that doesn't exist in SharePoint, you will probably have to create it via code. A safe way to do this is with the SPWeb.EnsureUser.
Checks whether the specified login
name belongs to a valid user of the
Web site, and if the login name does
not already exist, adds it to the Web
site.site.
So really, to answer your question, nowhere. You need to look for them where they could be coming from.

Categories

Resources