Grails: How to get information about the currently logged in user? - authentication

I am actually feeling a bit dumb for asking this but I tried for half a day now and can't find a way to get information on the currently logged in user in my controllers as well as my views.
I tried several suggestions I found on the web like "authenticateService" etc.
Now, it is possible that I have a misconception about the basics of Grails there. I come from other frameworks where a task like this is a matter of {{ request.user }} and I am done with it.
My exact need is to be able to access the ID of the currently logged in user in order to serve a custom navigation.
Thx in advance for your help.

def user = springSecurityService.currentUser
always good to try the docs:
http://burtbeckwith.github.com/grails-spring-security-core/docs/manual/index.html
In gsps, there is a specific tag, which we use like
<sec:loggedInUserInfo field='firstName'/>
again, its in the docs posted above.

Nowadays, I think the way to do it is:
def user = getAuthenticatedUser()

Related

How can I gain permission in HealthKit for writing workout routes?

I'm trying to add map data to my saved runs and bike rides for an Apple Watch app. I'm using CLLocationManager and HKWorkoutRouteBuilder.
Apple seems to have a pretty decent guide on building workout routes here. However, I'm struggling with the sentence in the documentation that says: "Specifically for route data, you must request permission to read and share both HKWorkout and HKWorkoutRoute samples."
Below are my app's current permissions. I know I still need "Workout Routes" to show up as an option, but am struggling to do so. On top of that, I'm not exactly sure if there are other permissions that I would need to obtain as well.
Thank you so much for your help!!
-David
Whelp... this seems to answer my question!
let sampleTypes: Set<HKSampleType> = [
HKSampleType.quantityType(forIdentifier: .heartRate)!,
HKSampleType.quantityType(forIdentifier: .activeEnergyBurned)!,
HKSampleType.quantityType(forIdentifier: .distanceWalkingRunning)!,
HKSampleType.quantityType(forIdentifier: .distanceCycling)!,
HKSeriesType.workoutType(),
HKSeriesType.workoutRoute(),
]
Just had to add the last two lines to the array of sample types. I hope this helps at least one other person!

Multiple comment plugin loading on Blogger

on my blog I’m using from a long time the IntenseDebate pluging as commenting system in place of the default one.
I would replace it with Google+ comment system but I don’t want to lose all comments already left by the users via IntenseDebate, so I would figure out if there’s any way to load on the old posts the IntenseDebate pluging in place of the default Google+.
As possible solution, I’m thinking something like a tag in the html post code that (if defined) load the IntenseDebate pluging.
What do you think?
its not posible to migrate IntenseDebate comment on google plus. Their is one solution that you can use multiple comment system in your blogger blog. just few month ago i had written trick for the same. I hope that this will be useful to you.
http://www.tipsviablogging.com/multiple-comment-system-blogspot/

Trouble logging in with BlogSpot

This question belongs on meta. I'd ask there, but I need to log in to ask a question, and that's where my problem is :)
I have an ID on BlogSpot.com (that's the Google Blog thing). I'm pretty sure that's my credential for this here site. However, I can't use it to log in to superuser.com (where I originally wanted to go) although I have my user ID linked to there.
The problem is, When I try to log in with my BlogSpot ID (and correct password), I end up on a 404 page; end of the line.
Could somebody please take a look? I'd prefer to get an answer here or to carl dot smotricz # gmail dot com, as I'm obviously unable to pick up answers on meta...
It seems that this gets solved by logging into Blogger in another tab (or browser window). Once this is done it seems to work.

VB.Net App to check personal Wordpress site for last post

I have a personal website that I want to see when the last post was made to it. Is there a way to find the last posted date on my blog?
In my application, I have a notification that I want to fire if we've made a 'News' post on our site so that our users are aware of any issues and I figured the best way would be to see when the last post was made.
Anyone have any ideas?
Thanks!
Since WordPress supports the metaWeblog API, you could use the XML-RPC.NET library to create a client that comminicates with your blog. You would use the metaWeblog.getRecentPosts method to get the most recent posts. You can find an example here.
http://www.pluralsight-training.net/community/blogs/aaron/archive/2008/08/19/programming-the-metaweblog-api-in-net-c.aspx
You might even be able to automate the login process, and scrape the post titles, comparing the first one to the one that was stored last. If they're different, it would indicate an update has been made.
Here's a method I came up with to automate the login part:
http://stateofidleness.com/2011/01/vbnet-automated-login-wordpress-site/
You could even connect to the mySQL database and query for the last entry date. (probably easier)

Lazy Registration on the Web: Best Practices

I first encountered the concept of lazy registration the Ajax Patterns site, where they define it as accumulating "bits of information about the user as they interact, with formal registration occurring later on." I'm looking at doing something similar for my website, but I'd like to know a little bit more about best practices before I start implementing it. My site is about web development, but general best practices are great too. How have you implemented lazy registration on your sites or projects? Where have you seen it in the wild? What do you like or dislike about it?
Have a look at this vid, a very good overview of the lazy registration pattern:
http://www.90percentofeverything.com/2009/03/16/signup-forms-must-die-heres-how-we-killed-ours/
I say this not as a person who has designed such a site before, but as a person that might visit that site. :)
With that said, the thing that I would be the most concerned about is knowing what kind of information is being collected about me. And I think that there should be an option to opt out of collecting the information and instead entering it all during formal registration.
But other than that, if it makes registering for a website easier, I'd be all for it. I leave 9 out of 10 sites that require me to register to do stuff.
One way that I was thinking about implementing this is when users leave blog comments. A common Wordpress format is to allow site visitors to comment as long as they leave a name and an email address. If I followed a similar pattern and then after they submit their comment, ask them if they would also like to register by having username and password inputs right there, with their email pre-filled in the email address input. There would also be a message saying that if they choose not to register at that time, their email address won't be saved (other than in association with the blog comment). If you think of something to add to this, leave a comment.
Use OpenID.
I hate it when I have to enter the same data over and over again, and to think of new passwords because you (read: the website) likely store them as plaintext.
Oh, and please don't require me to give you a fake email.
Like this way www.soup.io/signup or the email way www.posterous.com or www.tripit.com