How to access (read) custom fields from the directoy?
If I create the Directory Model the custom field of the directory are not shown.
Has someone done this before with App Maker?
Best regards
Karl
Directory Model is read only. You can try to create Calculated Datasource and call AdminDirectory advanced service to get user records with custom fields:
Enable 'Google Admin Directory API'
Click Settings gear button on the top right
Select App Settings tab
Scroll to Advanced Services section
Add 'Google Admin Directory API' service
Create Calculated Model with directory fields you need (let's name it CustomDirectory)
In the calculated model's datasource server script you can add code like this to query user record from the Directory:
var email = query.filters.Email._equals;
var user = AdminDirectory.Users.get(email);
var record = app.models.CustomDirectory.newRecord();
record.Email = email;
record.FieldA = user.FieldA;
record.FieldB = user.FieldB;
...
return [record];
Query calculated datasource from the client:
var ds = app.datasources.CustomDirectory;
ds.query.filters.Email._equals = 'bob#example.com';
ds.load(function() {
console.log(ds.item);
});
You can even avoid writing client side code, if you use bindings magic.
Notes:
Since I'm not Directory admin, I had no chance to test if all links of this chain work.
Most likely you'll need to deploy your app as developer to let all your app access Google Admin Directory API.
Further reading:
https://developers.google.com/apps-script/advanced/admin-sdk-directory
https://developers.google.com/appmaker/security/identity
https://developers.google.com/appmaker/models/calculated
Related
I need to write a python script for GitLab that allows me to change the email addresses of users
The problem is that I manage to change various user attributes, such as "bio" and etc
But I can't change the "email".
The script reports a successful change of these attributes, but in fact they do not change.
I am working as the root user, using his token
To change the user attributes, I use this construction
gl = gitlab.Gitlab(arg.url, private_token=arg.token)
user = gl.users.list(username = 'name')[0]
user.bio = f"{user.username}#EXAMPLE.COM"
user.save()
I also tried working with classic requests, instead of the gitlab library, but the result was the same
firebase dynamic links
I have successfully created an url prefix (giftittest.page.link) to which I have added a dynamic link (giftittest.page.link/list).
I followed the procedure to add an associated domain to xcode.
xcode associated domains
From safari I insert in the url 'giftittest.page.ling/list', it offers me to open my app, I press ok, the app opens correctly and I can intercept the dynamic link with the function
dynamicLinks().onLink(dynamicLinks => {
console.log({dynamicLinks})
})
and
dynamicLinks().getInitialLink(getInitialLink => {
console.log({getInitialLink})
})
how can I pass parameters to my app in query string?
how to assign roles to users with meteor?
I installed the package meteor add alanning: roles, and then I went into command prompt and typed the meteor command shell to access the meteor console server side. and i typed this code:
Var = myId Meteor.users.findOne ({username: "Elsa"}) ._ id
Roles.addUsersToRoles (myId, [ 'admin'])**
to assign the right to the admin user and Elsa in Mongolia I see no added admin roles in the collection
If you use the package
https://github.com/alanning/meteor-roles
Please be sure that username in database is unique.
Try these inside Meteor.startup code much before in server folder, place these
var id = Meteor.users.findOne({username: "Elsa"});
Roles.addUsersToRoles(id._id, ['admin'], 'default-group');
Hope these help
I'm trying to do a web application in which the user creates a account in the /extranet domain and its disabled initially.
When the sitecore admin enables the user account an function should be triggered so that a mail can be sent to the user, But i'm not finding any solution to trigger the code.
This is the code i have used to create the user in /extranet
Membership.CreateUser(mailId, password, mailId, "question", "answer", false, out status);
Well, there's a command that gets executed (<command name="usermanager:enable" type="Sitecore.Shell.Framework.Commands.UserManager.Enable,Sitecore.Kernel"/>) - which you can find in the Commands.config file in the App_Config folder - when you click on the Enable button, so you could override that with your own code (don't forget to also run that Enable functionality of course.
Please refer:
http://techmusingz.wordpress.com/2014/06/15/notify-sitecore-user-on-account-enable/
for a complete example of overriding the corresponding command.
You will need to replace
<command name="usermanager:enable" type="Sitecore.Shell.Framework.Commands.UserManager.Enable,Sitecore.Kernel"/>
with <command name="usermanager:enable" type="Sitecore72.Classes.EnableUserNotify, Sitecore72"/>
You could use the reflected code from Sitecore.Kernel.dll, and append your logic for notification in the Run method - where args.IsPostBack is true, after the user profile has been updated (user.IsApproved = true;)
This would enable you to retain the message boxes as implemented by sitecore and add the custom functionality you need as well.
I use the admin credentials for all of my interactions with the google api and I can retrieve\create\update\delete events from and for all of my hosted domain users. However, when I go to create a calendar for a hosted domain user, the calendar is created in the admins space. In the example below the GoogleUserName does NOT match the GoogleAccount.
The postUri would look similar to :
http://www.google.com/calendar/feeds/user#hosteddomain.com/owncalendars/full and the GoogleUserName is admin#hosteddomain.com. The api creates a calendar but it is in the admins space.
CalendarService service = new CalendarService("Test");
service.setUserCredentials(GoogleUserName, GooglePassword);
CalendarEntry calendar = new CalendarEntry();
calendar.TimeZone = "America/Chicago";
calendar.Title.Text = Title;
calendar.Summary.Text = Description;
calendar.Color = Color;
calendar.Selected = true;
calendar.Hidden = false;
Uri postUri = new Uri(String.Format("http://www.google.com/calendar/feeds/{0}/owncalendars/full", GoogleAccount));
CalendarEntry createdCalendar = (CalendarEntry)service.Insert(postUri, calendar);
The documentation does specify to use the users credentials however the documentation is not specific to hosted domains a great deal of the time and as such I am always attempting trial and error when trying interactions. That I can use all of the CRUD on the user's events themselves using the admin credentials leaves me to believe that it might be possible.
I have met the same problem. Also I tested a lot on the feed url. I believe that change the "owncalendars" section to "private" will make your request perfectly.
So the url should be "http://www.google.com/calendar/feeds/user#hosteddomain.com/private/full"
While this one will create the new calendar under the "user#hosteddomain.com" default calendar which is not what I expected. I am still looking for a way to create a new calendar for common user as an domain admin role.