Status attribute for external group membership - google-api

I have G-Suite group containing external users (from gmail.com). When I call Get all members API, until 2018-12-17 google returns status attribute for all members, but now it's empty for external users:
{
"kind": "admin#directory#member",
"etag": "",
"id": "1234",
"email": "user#internal.domain",
"role": "MEMBER",
"type": "USER",
"status": "ACTIVE"
},
{
"kind": "admin#directory#member",
"etag": "",
"id": "4321",
"email": "some+user#gmail.com",
"role": "MEMBER",
"type": "USER"
}
Documentation says nothing if status is mandatory attribute or not.
Can you please explain how to get all active members of certain group?

Maybe try using the Members: list API method instead?
Perhaps also try setting the flag for includeDerivedMembership to true (defaults to false)

Related

How to get only specific fields with Google Directory API users.list

The documentation (https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/list#query-parameters) says you can use customFieldMask to get only specific fields. I cannot figure out the format/structure of this property.
For example, given this for a user:
{
"kind": "admin#directory#user",
"id": "...",
"etag": "\"...\"",
"primaryEmail": "...",
"name": {
"givenName": "...",
"familyName": "...",
"fullName": "......"
},
"emails": [
{
"address": "...",
"primary": true
}
]
}
I only want to get primaryEmail but I can't figure out how.
Send "users(primaryEmail)" in the fields parameter, not in the customFieldMask parameter.
The Directory API can't retrieve the 'primaryEmail' with the customFieldMask attribute, with this attribute you can only specify the custom schema names that you create in the Admin console.

Google Workspace Admin SDK insert member always set type to "USER", how to resolve this?

https://developers.google.com/admin-sdk/directory/reference/rest/v1/members
https://developers.google.com/admin-sdk/directory/reference/rest/v1/members (click for image)
It doesn't matter what I set "type" field to, in the request. It always sets it to "USER" in the response.
This is the request (click for image):
{
"email": "abcd#xyz.com",
"type": "EXTERNAL"
}
This is the response (click for image):
{
"kind": "admin#directory#member",
"etag": ""9zPsLeP9ycRovNIzMe3UcREkFqt8n_JNHD4izBpxyt4/BY6DTvfyl-lbLpaBG_gjKb9l_X0"",
"id": "110243826665778914981",
"email": "abcd#xyz.com",
"role": "MEMBER",
"type": "USER",
"status": "ACTIVE"
}
I tried to do the same, after unsuccessful attempts something I missed to notice in the documentation is the below:
EXTERNAL: The member is a user or group from outside the domain. (Not currently used)
Basically, it does not matter whether the user is external/internal its type will always be set to 'User'.

Microsoft bot framework for teams capturing unique user id

We are building a product integration using ms teams and ms bots. We are having an existing integration with Slack already. In the slack World we identify a unique user by TEAM_ID and USER_ID . In case of Teams I can see even id in the from node is a very long string suggesting its unique. Below payload is one example coming to our server. Can someone confirm if using id from the from node is wont change a particular user ever?
the user id being assumed unqiue to a user below is "29:1374Bmi6ngJLBlF9oGVcDuTaBbMfJmcOF9eUvQVdx_rgYh5spPNQ5Mi6fLdVvCiT7mQPMNytT0zGk_iAUtvqKAwXXXX"
{
"_activity": {
"id": "1576102076169",
"from": {
"id": "29:1374Bmi6ngJLBlF9oGVcDuTaBbMfJmcOF9eUvQVdx_rgYh5spPNQ5Mi6fLdVvCiT7mQPMNytT0zGk_iAUtvqKAwXXXX",
"name": "My Name",
"aadObjectId": "37a2516a-baf2-41d8-a406-a067888d676c"
},
"conversation": {
"conversationType": "personal",
"tenantId": "9bfb3569-994e-4908-855c-c7f6c1a94100",
"id": "a:1DcGjCAgiuinvuzR0Mx6dR9uJOB3YUwjMdLOiGTAwQ7KWSGsiEijNfvir66ep7k0fABwoSXxCAACx2_3GflfTNIZL7XMkfjrMm0v8OzJJ7vvIFKasqrClrZ_T-8dDfdT0"
},
"channelData": {
"tenant": {
"id": "9bfb3569-994e-4908-855c-c7f6c1a94100"
}
},
"text": "contact mat",
"textFormat": "plain",
"type": "message",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/amer/",
"recipient": {
"id": "28:a835cf1d-83a8-4ae9-845a-23a68a1df442",
"name": "FlashCX.ai"
}
}
}
#Moblize IT Yes the id obtained from activity.from.id is the unique id for user and it wont change.

No ChannelData except message text while receiving incoming message from Skype in Bot Framework

When I'm receiving the message from Telegram, I get detailed information about account in Activity.ChannelData field (such as username, conversation_id and so on).
{
"update_id": ,
"callback_query": {
"id": "",
"from": {
"id": ,
"is_bot": false,
"first_name": "",
"last_name": "",
"username": "",
"language_code": ""
},
"message": {
"message_id": ,
"from": {
"id": ,
"is_bot": true,
"first_name": "",
"username": ""
},
"chat": {
"id": ,
"first_name": "",
"last_name": "",
"username": "",
"type": "private"
},
"date": ,
"text": "Example text"
},
"chat_instance": "",
"data": ""
}
}
But when it comes to Skype, all I see is the message text and nothing else.
{ "text": "Example text"}
How to know out, who exatly sent me the message?
Upd: That should not be exactly the user's name, any additional data like user unique id would fit.
Unfortunately, what is returned is channel specific, as determined by the channel developers. It is not a function of the Azure Bot Service or Bot Framework that determines this.
As for knowing who sent a message, this is not possible. Skype only returns a unique id per user in order to provide a layer of confidentiality with respect to privacy concerns.

Access control at property level (hiding/showing properties in api response based on the role)

I have a spring-boot based micro-service generated using JHipster.
I am using keycloak as my Auth Server. I could enable Role-based & scope based authorization on my resources(apis).
Now the requirement is: based on the role of the client, I need to restrict the information to send in the response (either mask the attributes or nullify them).
eg:
consider the following api to get the person's profile
/api/person/{id}
{
"name": {
"firstName": "Jack",
"lastName": "Sparrow"
},
"gender": "MALE",
"emails": {
"details": [
{
"emailId": "jack.sparrow#gmail.com"
}
]
},
"phones": {
"details": [
{
"phoneNumber": "1234567890",
"countryCode": "+1"
}
]
},
"addresses": {
"details": [
{
"addressLine1": "aaaaaaaa",
"addressLine2": "bbbbbbb",
"city": "cccccc",
"state": "ddddd",
"country": "South Africa",
"postalCode": "987654"
}
]
},
"photo": "string",
"nationality": "South Africa",
"countryOfResidence": "string",
"active": true,
"createdAt": 1537431339569,
"modifiedAt": 1537436600693,
"createdBy": "admin",
"modifiedBy": "admin"
}
Now, when a person with BASIC role calls this API, the requirement is to show only basic information like:
- name, gender
If he has INTERMEDIATE role then we can send something more than basic but not full information. eg: name, gender, photo, nationality
If he has ADMIN role then we can send the complete information.
Can anyone please let me know What is the best approach to achieve this.
-- Thanks in advance :)

Resources