I'm making a project with java spring where i do specific searches to the content of some attributes from a user or ad group. Also i write some text input to specific attributes.
Now i want to go a little but futher ..
The idea is that i do an open search on a specific AD group of users. When in this group an attributes or something else from a user changes, then the AD must send a message to my java program or something to tell me "attention user x has changed".
If i know that, i can do a new search to look if the attributes has changed of that user.
I know that i can solve this to do every time a search on the timestamp of the users in this AD group .. But it is not the perfect solution. Because then i must do everytime searches to every timestamp. And if there are for example 5000 users in this group. And i start with user 1 and user 4000 has changed yeah .. then it wil take a minut or something until i know that user 4000 has changed.
So i want a real time search thing.
Can you help me with this ? Can you put me into a direction that i can search futher on the web to find a solution or something. Or is this just not possible ?
Thanks a lot
Active Directory does not have a push notification feature, so this is not possible to do. You will need to search periodically to find the accounts you want.
You can, however, change your criteria to only find the accounts you want. The whenChanged attributes has the date the account was last changed. You can make a query to ask for members of that group, which have recently changed.
For example:
(&(objectClass=User)(whenChanged>=20190108000000.0Z)(memberOf=CN=mygroup,OU=Groups,DC=domain,DC=com))
A description of the date format used with whenChanged is here.
The memberOf condition should match the distinguishedName of the group. If the group has other groups inside it and you want to find members of those too, then you can do a recursive search:
(&(objectClass=User)(whenChanged>=20190108000000.0Z)(memberOf:1.2.840.113556.1.4.1941:=CN=mygroup,OU=Groups,DC=domain,DC=com))
That crazy number is called LDAP_MATCHING_RULE_IN_CHAIN and described here.
Related
I hope this makes a bit sense, basically, I have this feature in my app for tracking calories which consists of having this page that only appears the first time you use the feature and it asks you to add personal details (so it can make the right calculations), after that you get faced with a simple page that tracks your nutrition with a button for the user to insert the meals he has eaten, this page has to save the inserted data (via firebase) and then restart from 0 each and every day.
my first problem is I don't know how I make the page that only appears one time to save personal data(to be more precise I don't know how to make only appears the first time). and the second problem is how do I make the app automatically sends the given data at the end of each day?
interface in normal state, interface when adding the meals
hopefully, this 2 images will help you get a better grasp of what am trying to explain
don't worry am not looking for someone to straight up solve it all for me, I just need some orientation about what type of things/functions I need to do to solve these 2 problems
While #Narendra_Nath's answer might work, please note that is not a bulletproof solution. Why? Because a SharedPreferences doesn't persist across app uninstalls. This means that your user can install and uninstall the app and see the page as much as they want. So if you indeed want a user to see a screen only once, then you should consider storing that data in a database. Please note that SQLite isn't also a solution because when a user uninstalls the app, everything that is stored locally is wiped out. So what's the solution?
The best way to solve this would be to store the data in the cloud, either in Cloud Firestore or in the Realtime Database. So you can set a boolean variable and always check against it.
If you however intend to implement Firebase Authentication, then another solution would be to display the screen when your users are authenticated for the first time. So even if they will try to sign in on another device, install and uninstall the app, they won't be able to see the screen again.
Regarding the second problem, you should consider using Cloud Function for Firebase. It's the most elegant solution. If you want to somehow schedule an operation, then you should consider using Cloud Scheduler, as explained in my answer in the following post:
Is it not possible to have a code in the background who will be called every 24h?
Make the page that only appears one-time -> store a value in the shared preferences "isInfoShownToUser -> false" then do a check when the app starts to check if this value is false or true. If it is false show the "take the info" page .. then turn the value to false in the shared preferences.
How do I make the app automatically send data -> Use a Workmanager implementation to send data to the server (Firebase) at a particular time ..
Or use a implementation like the first one which uploads the data to the server just once everyday
Instagram seems to have something called pk, i would think this is some sort od uuid for each user but it's only long and instagram has millions of users i dont think that's it. Is there any way to get a user's id or to somehow identify him even when he changes his username?
I've looked around and there isn't really a straight answer on what pk is or how to do this.
I am using this library if it matters: https://github.com/instagram4j/instagram4j
I am not familiar with the library in question, however conceptually a long is more than enough to cover all the Instagram users.
In fact, a long can represent 264 numbers, which assuming that there are 7.9 billion people in the word, is a massive 2335030895 times the entire population.
If you would simply inspect the web browser you will find the user id attached to each profile, this id doesn't change even if a user changes their username.
This same id is used to make different calls like following a user or unfollow. I use my own automation scripts and it works fine using it.
I am new to Java and MySQL, and I want to build my first app. So, I run into a few problems at the start. Two of them to be precise...
I want to make an app (for free), to support a local Board game club, and here is the catch.
The club wants to use Barcode scanner to read barcode in their member's membership cards. This should alter a field in their database, which is 'bit' type, corresponding to member being in the club, or not (with 1 being active, and 0 being away).
Other thing is, the member should be 'active' for the whole day, and his 'activity' should reset at the end of a day.
I was thinking of making it a session, but how do I make it expire at the exact time?
Now, I have looked for answers in other questions, but have found nothing of use...
I am here for further clarifications if needed...
Thank you in advance :)
The barcode scanner is, for the most part, just a keyboard replacement. Instead of typing the code by hand, the scanner will send the keystrokes for you. You don't really need to do anything about it.
I assume the barcode represents member ID. When your application reads a barcode, it should then do something like this: update members set active=1 where member_id = xxx, with xxx being the barcode.
At the end of the day, you want to check all members out. You'll do something like this: update members set active=0 where active=1. Depending on your situation, you can either make a button to run this action, or you can make a cron job/task schedule that will run at some fixed time.
I have a list of users across various companies who are using one of the functionality that our website provides. Whenever they contact our business group , we need to send a url via email to the requestor in order for them to upload some data. All these external users do not have any dedicated account. However we do not want a static link to be provided to them as this can be accessed by anyone over the internet. We want dynamic links to be generated. Is this something that is usually done? Is there an industry accepted way of doing this? Should we ensure that the dynamic link expires after a certain amount of time - if so , are there any design options?
Thanks a lot!
Usually, parameters to urls and not the actual urls are what's dynamic. Basically you generate params that are stored somewhere, typically on the database, and send email with the url and the parameter(s). This url is valid for only a limited period of time and possibly only for one request.
Answers to questions:
yes, this is something that is quite commonly used in, for example, unsubscribing from a mailing list or validating an account with a working email address
I'm not aware of any single way that is "industry accepted", there are many ways of doing it, but the idea is not that complex - you just need to decide on a suitable token format
normally you should ensure that the link expires after a certain amount of time. Depending on the use case that can be some days, a week or something else. In practice, you'd remove or disable the generated parameters in your database. However, if this data is something that might be needed for extended periods of time, you might want to think up a functionality so that it can be retrieved later on.
You may have a static URL taking a token as parameter. Eg. http://www.mycompany.com/exchange/<UUID> or http://www.mycompany.com/exchange?token=<UUID>.
The UUID could have a validity in a time range or be limited to a single use (one access or one upload).
Other variant is to use exists cookies on that site in web browser (of course, if they are).
But there are some drawbacks in this solution:
User can open link in different machine, different browser. User can clean all cookies or they can expire after it was visited your site last time when user try to go on granted URL. In these cases user won't access your page.
I have three questions related to LDAP and Java.
is there any way to find the newly created users on the windows active directory using Java? Now I am get the all users from active directory loop through them and using the whencreated attribute for identify the new users.
same like previous one is there any way to find the users attributes that recently modified on active directory (like firstname changed or email changed like that) using Java? Currently I am identify using whenchanged attribute.
is there any way to identify the info about the user is locked/unlocked or he is in active/de-active like that?
LDAP search filters should give you what you need.
Use (&(objectClass=user)(whenCreated>=20110701000000.0Z)) to get user accounts created on or after July 1, 2011.
Use (&(objectClass=user)(whenChanged>=20110701000000.0Z)) to get user accounts changed on or after July 1, 2011.
Use (&(objectClass=user)(whenChanged>=20110701000000.0Z)(userAccountControl:1.2.840.113556.1.4.803:=2)) to get accounts changed on or after July 1, 2011 and that are disabled. Use a bitwise filter matching rule identifier to check for specific userAccountControl flags.
If these queries will be executed often, you might want to index the whenCreated and whenChanged attributes.
Active Directory does support notifying LDAP clients on change through persistent searches (note, however, the limit of 5 searches per connection). I haven't personally ever used this, but there are examples here, here, and here (in particular, notice that Active Directory apparently uses a different OID for these searches. Note that monitoring for ADDs is pretty straight-forward, but modifications will require some work on the part of your Java app, as Active Directory sends modify notifications on any modification operation, regardless of attribute.
#raddeman is exactly right regarding locks/unlocks and enabled/disabled. Simple bitwise operations on userAccountControl will help you get extract these values (e.g. userAccountControl & 2 == 2 indicates a user is disabled.
1)
LDAP is a protocol where you can not (what i know of) sort the result without doing it manually (in your case, in Java). Another thing that you might find is the value you searched for stored in its own field, as msSFU30MaxUidNumber in Active Directory to get the largest UNIX UID in the AD.
EDIT: As noted by #EJP, you can specify sorting if the LDAP-server supports it. In Java, look at javax.naming.ldap.SortControl
2) I think this is the same as 1.
3) Yes, look at the userAccountControl field. It contains values that could be found here: http://support.microsoft.com/kb/305144 such as ACCOUNTDISABLE (2).