MSAL popup: Is it possible to display only the users from that specific tenant - msal

I've used domain_hint: "example.com" and it does list the accounts that match that domain but is there a way to list all the accounts under the provided tenant ID?

You can list all users in your tenant using MS Graph.
Please go through MS Document.
For example below java script will return all users of particular tenant,
const options = {
authProvider,
};
const client = Client.init(options);
let res = await client.api('/users').get();
Make sure your MSAL token contains minimum User.ReadBasic.All permission to achieve this.

Related

Cant create Microsoft Teams online meetings for some users (Defaults to OnlineMeetingProvider.Unknown) via Graph Api

I have 5 users, they all look the same in Office 365 (from what I can see anyway) and have Teams Exploratory licences. I am able to create online meetings (OnlineMeetingProvider="teamsForBusiness" and IsOnlineMeeting=true) for 2 of them. For the other 3 users it doesn't error but doesn't create an online meeting (creates an event?), the response OnlineMeetingProvider is "unknown" and the OnlineMeeting is null. It is the same code so has to be a setting somewhere (all i do is change the id of the user).
The code used to create the request:
// Create client
var graphServiceClient = CreateGraphClient();
// Build event
var newEvent = new Event()
{
Subject = subject,
Body = new ItemBody() { ContentType = BodyType.Text, Content = body },
Start = startDate,
End = endDate,
IsOnlineMeeting = true,
Attendees = attendees == null ? null : GetAttendees(attendees),
OnlineMeetingProvider = OnlineMeetingProviderType.TeamsForBusiness
};
The erroneous response:
Anyone have any idea what is going on?
Had the same problem, I had to add these permissions to the app I was using to create the meeting events:
TeamSettings.Read.All, TeamSettings.ReadWrite.All
As soon as I added them, isOnlineMeeting was correctly set to true, and onlineMeetingProvider was set to teamsForBusiness, as specified in the request.
onlineMeetingUrl is always null, but it's possible to get the meeting url from the "onlineMeeting.joinUrl" property, which is automatically populated by the API.
UPDATE:
As #lokusking pointed out, even if this is correct, it looks like it does not completely solve the problem. According to my tests, creating a Team event for a new user and getting isOnlineMeeting=true and onlineMeeting properly populated in the response will work only a couple of hours after the user account is created. Note that even with a fresh user the event IS created, just those properties won't contain the right values.
You can change an existing event to make it available as an online meeting, by setting isOnlineMeeting to true, and onlineMeetingProvider to one of the online meeting providers supported by the parent calendar. The response includes the updated event with the corresponding online meeting information specified in the onlineMeeting property.
https://learn.microsoft.com/en-us/graph/outlook-calendar-online-meetings?tabs=http#example-update-a-meeting-to-make-it-available-as-an-online-meeting

How to log transcripts of both User and bot

I've enabled transcript logging by
Use(new TranscriptLoggerMiddleware(new AzureBlobTranscriptStore(settings.BlobStorage.ConnectionString, settings.BlobStorage.Container)));
It only stores User messages though. How do I make it log bot answers too?
Is there a way to convert a bunch of JSON files into readable line-by line transcript like one user sees in the webchat?
I don't see why this would make a difference, but this is how I'm setup. Fundamentally, I'd say it's not really different than your setup. Are there any other settings, configurations or middleware you are passing thru that you have enabled and might be interfering?
const transcriptStore = new AzureBlobTranscriptStore({
storageAccountOrConnectionString: process.env.blobStorageConnectionString,
containerName: process.env.blobStorageContainer
});
const transcriptMiddleware = new TranscriptLoggerMiddleware(transcriptStore);
const adapter = new BotFrameworkAdapter(adapterSettings)
.use(transcriptMiddleware);
Hope of help!
I learned from this answer to create my own middleware that stores the incoming and outgoing activities in the database. I store them in Ms SQL, then I use sendConversationHistory to send the stored activities to the webchat.
https://stackoverflow.com/a/54228225/10531724
If you need more clarification please let me know.

Using parse.com, can multiple, authenticated users access the same data?

How can I "pair" multiple users, and have them access the same data - perhaps some of the users in a group having read only rights? As a use case, think of a family sharing calendars, each using their own login, but being able to see each other's calendar.
You should have a look at Roles and Security in the Parse docs.
I'm no expert, but I would assume that you would create a role for a family and then restrict the access to either classes or objects (depending on your approach) with Access Control Lists. In that way you can have a group/role that has the same permissions for same objects and classes.
Adapted from the docs:
Creating a role
// By specifying no write privileges for the ACL, we can ensure the role cannot be altered.
var roleACL = new Parse.ACL();
roleACL.setPublicReadAccess(true);
var familyRole = new Parse.Role("MyFamilyRole", roleACL);
familyRole.save();
Then
var calEvent = new Parse.Object("CalendarEvent");
var familyACL = new Parse.ACL();
familyACL.setPublicReadAccess(false)
familyACL.setPublicWriteAccess(false)
familyACL.setRoleReadAccess("MyFamilyRole", true);
calEvent.setACL(familyACL);
calEvent.save();
This can of course be done more efficiently by using defaultACLs and other functionality. But these are the basics.
Btw, I reference the JS api, since you didn't specify a platform.

How can a Google Apps Marketplace Application retrieve the number of users on a specific domain?

I am aware of the Users list endpoint in the Admin SDK Directory API. However, it is really slow since you must iterate over all users to calculate the count.
I am also aware of the currentNumberOfUsers endpoint in the Admin Settings API. However, that API does not have a read-only scope, and it contains a lot of other potentially sensitive information.
Is there a read-only API for retrieving the current number of accounts on a domain?
Users list endpoint is not that slow if you pass a "field" parameter instead of requesting all user data. A good "fields" value could be "users/primaryEmail".
If you only need the count, you could actually just iterate through the userList
Directory.Users.List userList = ...
while (... ) {
...
users = userList.execute();
result += users.getUsers().size();
...
}
return result;

Insert Moments on Googleplus with PHP: almost done... just an non-object error to solve

I am trying to post a moments on my Googleplus Business Page though a PHP script.
To call the Google APIs I am using service accounts.
The following code give this error "Fatal error: Call to a member function insert() on a non-object in (last Line)".... could you help me to solve this prob?
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_PlusService.php';
// Set your client id, service account name, and the path to your private key.
// For more information about obtaining these keys, visit:
// https://developers.google.com/console/help/#service_accountsconst CLIENT_ID = 'MYID';
const SERVICE_ACCOUNT_NAME = 'MYACCOUNT';
// Make sure you keep your key.p12 file in a secure location, and isn't
// readable by others.
const KEY_FILE = 'MYAUTHFILE';
// Load the key in PKCS 12 format (you need to download this from the
// Google API Console when the service account was created.
$client = new Google_Client();
$key = file_get_contents(KEY_FILE);
$client->setClientId(CLIENT_ID);
$client->setAssertionCredentials(new Google_AssertionCredentials(SERVICE_ACCOUNT_NAME,array('https://www.googleapis.com/auth/prediction'),$key));
// Create moment that does not have a URL.
$item_scope = new Google_ItemScope();
$item_scope->setId("MYGOOGLEPAGEID");
$item_scope->setType("http://schemas.google.com/AddActivity");
$item_scope->setName("The Google+ Platform");
$item_scope->setDescription("A page that describes just how awesome Google+ is!");
$item_scope->setImage("https://developers.google.com/+/plugins/snippet/examples/thing.png");
$moment_body = new Google_Moment();
$moment_body->setType("http://schemas.google.com/AddActivity");
$moment_body->setTarget($item_scope);
$momentResult = $plus->moments->insert('me', 'vault', $moment_body);
You can only write moments on behalf of an authenticated user when you use the https://www.googleapis.com/auth/plus.login scope. You can't use a service account to do this. More so you cannot authenticate as a Google+ Page so writing moments isn't possible in your scenario.
Do you think you might be able to edit your post to explain why you want to write moments on behalf of a Page? What is the goal that you are trying to achieve?
It seems you didn't initialize the Plus API Client:
$plus = new Google_PlusService($client);
You will also have to use the correct scope https://www.googleapis.com/auth/plus.login instead of https://www.googleapis.com/auth/prediction
And I'm not sure if writing moments will work with service accounts...

Resources