How get the custom attribute value set for the user in google workspace after login? - authentication

I want to receive the custom attribute value set for the user in google workspace after login.
I've set the profile,openid for the scope.
I've searched for it, but there was nothing for it and I can not find the related scope either.

Related

Deleting buddypress account without deleting user

I've recently started using Buddypress in conjunction with a plugin called memberpress on a site, and am running into a problem:
Basically, if you're logged in to the site, as the Admin for example, and you go to the buddypress profile page link, you're automatically set up with a buddypress membership/profile and listed in the member directory.
I don't want everyone who logs into the site to just automatically/accidentally become a buddypress member and to be listed in the directory.
So I need to A)know how to delete the buddypress membership when that occurs without deleting the user and their ability to log into the site and B)better yet, stop buddypress from automatically assigning membership without purposeful signup.
Any insight would be helpful, thanks!
Buddy press works not connection but using the user table for users profiles. It means if you delete user or buddy press profile both result same delete both.
It might possible
Case 1 hide buddy press profile from public by deregister profile for the user
Case 2 hide user from member directory only.

Set Internet-Explorer Homepage "once" via GPO

I want to set a Homepage via GPO. I know this can be done in
Preferences\Control Panel Settings\Internet Settings
The problem is that if I change the standard Homepage there it will always set it to that page after every logon, regardless if the user changes the homepage in the meantime.
I however want that it is only set once (i.e. google.com) and if the users changes it (i.e. to bing.com) it should stay on bing.
Can you tell me how this can be done?
Edit:
https://technet.microsoft.com/en-us/library/jj822332.aspx
"Group Policy preferences. You can use Group Policy preference settings to configure options that users can change later."
This is actually what I want to do. I set a preference and then the user can change it to something else later. However - setting it works fine, changing it too but after logout/login it is back to where it was before.
if I change the standard Homepage there it will always set it to that page ...
I however want that it is only set once
Can you tell me how this can be done?
Not at all. What you want to do is self-contradictional.
"Standard XYZ" means that XYZ will be done every time, and "XYZ only once" is the exact opposite.
I found the solution - it's surprising how difficult it was to find by googling. In the end I just stumbled over it by checking the policies again.

Google+ JavaScript API: How to detect user sign in status?

I have deployed Google+ Sign-in Button, now I have to provide Sign-Out Button, before that, I need to know whether the user is still signed in, by which I can then show or hide this button.
I found this documentation: gapi.auth.checkSessionState(sessionParams, callback):
https://developers.google.com/+/web/api/javascript?hl=en#gapiauthchecksessionstatesessionparams_callback
Could someone demo how to use it ?
Many thanks.
gapi.auth2.getAuthInstance().isSignedIn.get()
This returns boolean
You don't need to use a separate function call to determine the user's signed in state if you've already added the sign-in button. The sign-in button's callback is going to trigger either on sign-in, when the page loads, or any time that the user's signed-in status changes. The page load trigger (immediate mode), will also help to indicate if the user is a Google signed-in user or not.
See monitoring the user's signed in status, which shows the different status fields that you can check (Google signed in, app signed in, or signed out).
From Google dev docs :
If you pass null to sessionParams.session_state, you can check if the user is signed in to Google, whether or not they have previously authorized your app.
So your code will be like this:
gapi.auth.checkSessionState({session_state: null}, function(isUserNotLoggedIn){
if (isUserNotLoggedIn) {
// do some stuff
}
});
This is an example of how to use it:
gapi.auth.checkSessionState({client_id:'99999999999.apps.googleusercontent.com'}, signinCallback);
where client_id is the id of your project on g+ console. and siginCallback is a function i created to check the state.
IT'S VERY IMPORTANT to notice that the official api documentation says:
If the argument is true, the supplied session_state is still valid. If the argument is false, it is no longer valid and the application should perform a new re-authorization flow with immediate set to true to get an up-to-date access token or detect a non-authorized or nonexistent Google sign-in session.
But when i recive the response of checkSessionState i get true value when im signed off and false when im signed in. I Dont know if there was an error on the documentation but you can try it by yourself.
Hope this has been helpful for you.
PD: excuses for my awful english
Adapted from Tom Anthony's Blog
One simple way you can use without the use of an API to see if a user is logged into Google + (Or Google/Facebook/Twitter) is to try to access a resource which they would only be able to access if logged in. The code below attempts to load an image resource for which the user needs to be authenticated to access. By default html <img> tags run onload() if an image is successfully returned, but onerror() otherwise.
<img style="display:none;"
onload="function(){document.getElementById('signOutButton').style.visibility = 'hidden';}"
onerror="function(){document.getElementById('signOutButton').style.visibility = 'visible';}"
src="https://plus.google.com/up/?continue=https://www.google.com/intl/en/images/logos/accounts_logo.png&type=st&gpsrc=ogpy0"
/>

SPWebPartManager to hide webparts per user

Can I use SPWebPartManager to hide Web Parts per user programmatically?
Such as: Get the SPWebPartManager instance, iterate through the Web Parts, and set visible = false depending on the user.
I heard from somewhere there when you set webpart.visible = false this sets this for all the users, is this true?
You need to open the Web Part in the user scope in order to update user specific properties. Use the PersonalizationScope Enumeration to open the SPLimitedWebPartManager accordingly:
SPWeb web = // ...
using (SPLimitedWebPartManager mgr = web.GetLimitedWebPartManager(
"<path to page>",
PersonalizationScope.User))
{
WebPart wp = mgr.WebParts[<ID of the web part to update>];
wp.Hidden = true; // hide the web part.
mgr.SaveChanges(wp);
}
Note: In order to update a peropery in the PersonalizationScope.User the property needs to be marked as personal web part storage ([WebPartStorage(Storage = Storage.Personal)]):
MSDN description for the User PersonalizationScope scope:
When referring to the scope on the WebPartManagercontrol, User scope means that personalization data that is user-specific, as well as personalization data that applies to all users, is loaded for all personalizable controls on a page. Only personalization data that is user-specific can be saved on the page.
When referring to the scope associated with a Web Parts control property, User scope indicates that the property can only load and store data applicable to all users when running on a page in Shared scope. However, when the property's control is running on a page in User scope, the property's per-user and all-user data will be loaded and merged. In this case, though, only per-user data will be saved when a page is running in User scope.

How do I load a Sitecore sublayout automatically so that permissions are respected?

I've created a sublayout (usercontrol) with some simple html. I want to display this sublayout only if the user belongs to a certain role.
If I use the built in sitecore developer center to add the sublayout, I end up with something like
<sc:Sublayout runat="server"
RenderingID="{item guid here}"
Path="/layouts/sublayouts/someusercontrol.ascx"
ID="Sublayout1" placeholder="content"></sc:Sublayout>
Denying read permission for the sublayout used there has no affect (I assume it's getting loaded because the file path is there right? ). If I take the Path out I get nothing regardless of current user role.
I don't want to manually check if the current user is in the right role from the codebehind. What markup do I use to get the sublayout to consider the user's permissions and determine visibility?
I don't think it's possible to control sublayout visibility based on a user role in markup. If you dynamically added this sublayout to a placeholder, you could use conditional rendering ("Personalize" button in 6.5) to accomplish this, hiding the component unless the user is a member of a specific role.