FOSUserBundle: How to know which users are online - symfony

I'm using FOS Rest Bundle and I'd like to show which users are online in the website. I don't know (I couldn't find any info about it) if there's a way to query the database and get if a user is currently online or not.
Is there a way to know this or any other bundle that could provide this info?
Thanks in advance

Add a "lastActivity" (datetime) attribute in your User class and use an event for update the date of this field everytime the user do an action on the site.
After that, just get all online user in last x minutes with a simple doctrine query on this field.

Related

2sxc - Get Entity created and last updated UserID

DNN 9.1.1.
2sxc 9.14.
Is it possible to get userId or name of the user who last changed the entity and displays it in razor template?
Is it possible to get userId or name of the user who created the entity and displays it in razor template?
Is it possible to get entity history and displays it in razor template?
Also what about created and updated time of the entity?
Can someone give me some links to samples or documentation about this stuff?
Yes, accessing the owner is the right way - you'll have to work a bit to map it to DNN, but it's simple string splitting. Note that in some future release we'll probably change the owner mechanism to map to the guid instead of the ID, but that will still take a while and will be easy to adapt to once it happens.

How to retrieve date of birth of all connections in linkedIn API?

I want to get the date of birth of connections using LinkedIn api.I got some informations using
http://api.linkedin.com/v1/people/~/connections:(headline,first-name,last-name,location)
If i am trying to add dateOfBirth or date-of-birth parameter to this api but it is not working. Can anyone please help me to get the date of birth of all connections?
headline,first-name,last-name,location are comes under basic profile but date-of-birth comes under full profile. So you have add the permission(r_fullprofile) for this one. Try Like this
NSArray *grantedAccess = #[#"r_basicprofile ",#"r_fullprofile", #"r_network"];
According to this document, you will need to apply to be able to retrieve the full profile information, like date of birth:
Member profile fields available to Apply with LinkedIn developers
The following selection of profile fields are only available to applications that have applied and been approved for the Apply with LinkedIn program:
Full Profile Fields
(...)
For more information, visit the Apply with Linkedin page.
Note: This is an old question but things may have changed, so this is for future reference.

Assign entities to entity with checkboxes

So let's say I have two tables: permissions, and sort of a join table between users and permissions that we'll call permission_list
permission_list has user_id and permission_id.
permission has the name of the permission and a keyname for use elsewhere in the code.
Now I have an assign permissions page, that currently uses a dropdown list of all the available permissions. What I want to have is a list of checkboxes, where permissions in the users list are checked already, and unchecking them removes those records, and checking new ones adds new records.
Does Symfony2 have a built-in way to go about this?
Does this answer your question How to render a checkbox that is checked by default with the symfony2 Form Builder?
Form Builder has a lot of great features that will help you accomplish what you are looking for.
That link references this link http://symfony.com/doc/current/book/forms.html that has a ton of info but he gives a good suggestion. Let me know if thats not clear enough.

Display own records in grid view

Im new to asp and i need u guys to guide me pls? Okay, lets just straight to the point. How to display current user who logged in to the system their own data? Like my system is about tracking expenses spent by user monthly. So, once user entered the expenses, prices for that particular month, it will be stored in db of course. But the tricky part here is when the user log in again, they should be able to view back their own records. So, basically i have a drop down menu which is used for month, Jan-Dec, grid view which to view all the particular user's records, view button (when user choose month,they click on the button and the grid view will show the expenses for that particular month) and thats all. So, if you guys have any idea, solution, pls tell me how. I would be appreciated if you could gimme the step by step to do that. Thank you.
|username|Month|Expense1|price 1| Expense2|Price2|....//this is the eg of my db structure
P/s: i dont know how to use HttpContext.Current.User.Identity.Name. If you could guide me by gimme the steps, that would be great! Thank you again.
Firstly, You must be having a Login form to login and view monthly expense and make new entries.
Now you can follow the below steps and make all your application working.
Assuming you have created the database to store new users information with there passwords and expenses table storing data related to the expense with respect to particular user after login.
Steps
once the user is logged in to your application. You can store the
User ID in Session.
This session can help you to take are which user is logged in or there are no users logged in currently to your application
since you have the database filled with all the details related to
expense. After login check if you have any user id in your session
or your session is null or not.
if you find any User ID session just pass this as a SqlParameter to your store Procedure and fetch all the records of this User id.
If you find any records bind your results to grid view. Otherwise display no records found and give a provision to Add new Expense Detail.
If you are using MemberShip API for Maintaining User Account and Login then you can user the HttpContext.Current.User.Identity.Name get the User ID from this name using MemberShip class in System.Web.Security namespace.
Hope the above steps are clear and you follow the functionality properly, to solve your problem.

Drupal - Heartbeat activity - only showing activity wher a users is, the owner OR a member

Wondering if anyone knows how to create a view that only shows the activity of groups, where the current logged in user, is either the owner OR a member.
thanks :)
You can in views add an argument, and select the logged in user. You can use that to query whatever groups you are talking about.

Resources