How to know if a federate has joined a federation in HLA - federation

I am using HLA and the Portico RTI and I have a situation in which I have to know that if particular federates have joined the federation or not. Can someone help with this. This may be very basic but i am very new to HLA. Thanks in advance.

You can use the Management Object Model (MOM) to query the joined federates in a federation.
Subscribe to the object class HLAobjectRoot.HLAmanager.HLAfederate and you will be updated with all the federates in the federation, including your own.

ante's solution is standard procedure, but here is an alternative method:
Assuming you have assigned a unique name(string) to that particular federate upon joining. You can call "Get Federate Handle service" of RTIambassador, with the federate's name as input parameter. A handle of the federate will be returned if it exists in the federation, otherwise an exception will be thrown.

Check your RID file (RTI.rid). It must be in the directory that your federate is executed from. There are some parameters you can change to see all the logs. Delete the # acoording to log level you want
# (1.2) Portico Log Level
# Specify the level that Portico will log at. Valid values are:
TRACE, DEBUG, INFO, WARN,
# ERROR, FATAL, OFF. The default value is "WARN".
#
# portico.loglevel = INFO
# portico.loglevel = TRACE
# portico.loglevel = DEBUG

Related

Azure AD graph API to filter users with onPremisesExtensionAttributes [extensionAttribute6]

I need to filter users with the onPremisesExtensionAttributes [extensionAttribute6] is there a graph API call for it?
As #Tinywa suggested in the comment:
onPremisesExtensionAttributes contains extensionAttributes 1-15 for
the user. Note that the individual extension attributes are neither
selectable nor filterable.
You can get all the results first and use your own code logic to filter them.
Or you can consider using extensionProperty as a workaround. Create the extensionProperty and assign value for the users, and then query users with filtering with this extensionProperty. For detailed steps to create extensionProperty and assign value for users, you can refer to this answer.
It looks like they've updated the BETA Graph API so that extension attributes (onPremisesExtensionAttributes) are now filterable.
Try the below in Graph Explorer. You'll need to change the extensionAttribute1 eq 'Employee' part to a query that will actually work in your active directory environment.
https://graph.microsoft.com/beta/users?$count=true&$filter=onPremisesExtensionAttributes/extensionAttribute1 eq 'Employee'&$orderBy=displayName&$select=displayName,mail,onPremisesExtensionAttributes
Please note that this is the BETA Graph API so I guess that means Microsoft hasn't finalized it, so it might change or never get fully released.
EDIT: I also just learned that if you're using this filter via the Graph API, you must add the following header or you'll an error:
client.DefaultRequestHeaders.Add("ConsistencyLevel", "eventual");
The Graph Explorer has this header by default, I guess.
Here's where I found this answer: Get Extended Properties on User using Microsoft Graph
Here's the error I was getting:
Property 'extensionAttribute1' does not exist as a declared property or extension property.

Invalid Named Property

We call the microsoft exchange to set the extended property which in our case is an unique guid
microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: An internal server error occurred. The operation failed., Invalid named property
Its been working great until now when some of our users are facing the above issue ....
val uId = getUniqueId();
val emailExtendedPropDef = new ExtendedPropertyDefinition(uId,"uniqueId", MapiPropertyType.String)
try {
email.setExtendedProperty(emailExtendedPropDef, uId.toString)
email.sendAndSaveCopy()
} catch {
case e: Exception =>
error(s"Exception in setting extended property for user $from", e)
throw e
}
trying to find the root cause of the issue, we are also thinking it might be related to throttling on Microsoft exchange for extended properties (Not sure how to prove if it's indeed throttling) any help to point us in the right direction will be of great help
Our use case is to able to retrieve the email when customer want's to reply back we want to retrieve that particular email to be included in users reply....currently we are using the uid to achieve that ....
we have been using the code as per the documentation here
https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/dd633654(v%3Dexchg.80)
and also the documentation here
https://github.com/OfficeDev/ews-java-api/wiki/Getting-Started-Guide#extended-properties
Update : As per the comments we do understand that we have to treat extendedProperty as a column definition and update the same column ...but we couldn't figure out how to achieve this as...Any code samples to point us in the right direction will be of great help
Latest Update : We have deleted some of the extendedPropertyDefinition's but still facing the same invalid property could some one please point us in the right direction
Is it safe to say that getUniqueId returns a different guid on each call? If so, then that is the problem. Think of the Guid for an extended prop as a namespace. The exchange store limits the number of custom extended props to something like 32k per mailbox. So you are likely hitting that limit. But aside from that, the main reason for creating an extended property is so that you can refer to it later. But if you are basically discarding the namespace each time, you are leaving orphaned props on items. Without understanding your particular scenario, I can only say that the Guid should be thought of truly as a namespace. Choose one for your app/company/scenario and hard code it. They create all the named props you want within that namespace. For instance, "MyProp/String" in Guid namespace 1 is a different property than "MyProp/String" in Guid namespace 2.

Get instances during serializer validation in DRF

I am starting to work with the Django REST framework for a mini-reddit project I already developed.
The problem is that I am stuck in this situation:
A Minisub is like a subreddit. It has, among others, a field named managers which is ManyToMany with User.
An Ad is an advertising which will be displayed on the minisub, and it has a field named minisubs which is ManyToMany with Minisub. It has also a author field, foreign key with User.
I would like to allow these managers to add some ads on their minisubs through a DRF API. It is actually working. But I want to check that they put in minisubs only minisubs where they are managers.
I found a way like that:
class AdSerializer(serializers.HyperlinkedModelSerializer):
# ...
def validate_minisubs(self, value):
for m in value:
if user not in m.managers.all():
raise serializers.ValidationError("...")
return value
My question is: How to get user ? I can't find a way to get the value Ad.author (this field is set automatically in the serial data according to the user authentication). Maybe I don't find a way because there is no ways ? The place to do this is somewhere else ?
Thanks in advance.
You may get it out of the serializer this way:
class YourModelSeializer(serializers.HyperlinkedModelSerializer):
class Meta:
model=YourModel
def validate_myfield(self):
instance = getattr(self, 'instance', None)
...
I believe that this is a job for the permissions, if you are performing CRUD operations for inserting that into a database then u can have a permission class returns True if the user is a manager.
a permissions instance has access to the request which u can use to get the user and check if he is a manager:
http://www.django-rest-framework.org/api-guide/permissions/#custom-permissions

netusergetinfo return 2221

netusergetinfo is returning 2221 error code for valid user . What is the reason? It is because of some security setting on active directory but I am not aware of it.
Probably you have the same problem as described here Get current user's last logon.
One possible reason is that you don't use UNICODE format for the user name.
Another problem is if you try to ask the name of domain user. In this case you should use not a form
nStatus = NetUserGetInfo (NULL, L"Domain\\TestUser", dwLevel, (LPBYTE *) & pBuf);
but use as the first parameter the name of a domain controller from a domain which has trust to domain "Domain". You can use DsGetDcName or NetGetAnyDCName or NetGetDCName to get this name.
To answer on your question exactly you should post the corresponding source code and describe shortly your domain environment and the role of the computer and the current user under which current process are running.
API: NetUserSetInfo / netusergetinfo
Error Code: 2221
Reason: The Username you are trying to update is not present in the system.
for reference:https://learn.microsoft.com/en-us/windows/win32/netmgmt/network-management-error-codes

Generic LDAP base for search?

I'm writing some C++/Win32 code to search for a user in an LDAP directory (really I need to validate a username/password is correct, and then verify group membership). I have the username, so I'm hoping something like the following will work:
(&(objectCategory=person)(objectClass=user)(uid={username}))
When I call ldap_search with this search/filter, I have to provide a starting base (node/OU/whatever) to search. But I don't know where to start the search -- all I have is the username. Is there anyway to specify the root of the tree that will work with OpenLDAP, Active Directory, Netscape LDAP, etc, etc?
Also, anyone that can answer that could probably help with this: Is the uid attribute universally supported, or do I need to search on a different attribute depending on what brand of LDAP server I'm talking to? (I've seen references to people needing to search on uid, CN and even SAMAccountName).
Regarding your first question about generically retrieving a search base:
Every LDAP directory server (conforming to the LDAP protocol I think) exposes some operational thingies under a node called RootDSE. One of the things you can retrieve through RootDSE are the namingContexts which essentially can tell you what the different trees are hosted on this server.
So you can retrieve a top-level search base for your username-search. Please be aware: some LDAP (OpenLDAP for example) servers can host multiple trees so you have to come up with a solution when multiple naming contexts are found.
The RootDSE can be retrieved by querying the server for the DN "" (empty string) and specifiyng that you want to get all the operational attributes as well. Just some example for an OpenLDAP server:
ldapsearch -H ldap://ldap.mydomain.com -x -s base -b "" +
# note the + returns operational attributes
This should return something similar to that shown below (from OpenLDAP 2.4.8) - the values in parentheses are added explanations and are not returned by the server:
dn:
structuralObjectClass: OpenLDAProotDSE
configContext: cn=config
namingContexts: dc=example,dc=com
namingContexts: dc=example,dc=net
monitorContext: cn=Monitor
supportedControl: 1.3.6.1.4.1.4203.1.9.1.1 (Contentsync RFC 4530)
[...]
supportedExtension: 1.3.6.1.4.1.4203.1.11.1 (ModifyPassword RFC3088)
[...]
supportedFeatures: 1.3.6.1.1.14 (Modify-Increment RFC4525)
[...]
supportedLDAPVersion: 3
supportedSASLMechanisms: NTLM
[...]
entryDN:
subschemaSubentry: cn=Subschema
(from http://www.zytrax.com/books/ldap/ch3/#operational)
Regarding your second question about the availability of the uid attribute:
I don't think that you should rely on this one as it strongly depends on the schema used for storing user data (although most user-schema-classes will have a uid attribute I think). But that depends on the flexibility you want to put into your program. Perhaps the best way would be to make the user-filter-string configurable by the end-user (you could even do this with the search base which would have some performance advantages (no need to search the whole tree when users are only located in a small subtree and no need to query the RootDSE)).
I would not rely on uid being the proper search attribute for the user entries in LDAP. Many companies will only guarantee the employeeID as being unique within the LDAP DIT.
You need to define what container to start searching in. So this would be something like
"LDAP://" + _ADSPath + ":" + _ADSPort + "/" + _ADSRootContainer
where _ADSPath is the server hostname/ip; _ADSPort is the port number (usually 389 by default); and _ADSRootContainer is the rest of the path to the container (like ou=Users.
The path would depend on the implementation you are searching against. You can start up higher than the container holding the users and set the parameters on the search object to use a multi-level search. But it will be much slower.

Resources