posixAccounts API information missing - google-admin-sdk

I'm not seeing my posixAccounts information from the following link:
https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/get
{
"kind": "admin#directory#user",
"id": "8675309",
"etag": "\"UUID\"",
"primaryEmail": "email#example.com",
"name": {
"givenName": "Email",
"familyName": "Account",
"fullName": "Email Account"
},
"isAdmin": true,
"isDelegatedAdmin": false,
"lastLoginTime": "2021-08-04T21:11:17.000Z",
"creationTime": "2021-06-16T14:32:35.000Z",
"agreedToTerms": true,
"suspended": false,
"archived": false,
"changePasswordAtNextLogin": false,
"ipWhitelisted": false,
"emails": [
{
"address": "email#example.com",
"primary": true
},
{
"address": "email#example.com.test-google-a.com"
}
],
"phones": [
{
"value": "123-456-7890",
"type": "work"
}
],
"nonEditableAliases": [
"email#example.com.test-google-a.com"
],
"customerId": "id12345",
"orgUnitPath": "/path/to/org",
"isMailboxSetup": true,
"isEnrolledIn2Sv": false,
"isEnforcedIn2Sv": false,
"includeInGlobalAddressList": true
}
As you can see from the above output, there's no posixAccount information. I can open the ldap information in Apache Directory studio, so I know it's there, but I can't see it from the above output. Since I can see it though, I tried to update this using the update function in the API.
https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/update
I used this for the payload as I'm just testing updating the gid information. I used the documentation below to get the entry details needed. At least as far as I could tell.
{
"posixAccounts": [
{
"gid": "12345",
}
]
}
https://developers.google.com/admin-sdk/directory/reference/rest/v1/users
I'm getting a 200 response, but nothing is actually changing for the user when doing a PUT to update.
I tried a similar update method from another user on here, but no avail: Google Admin SDK - Create posix attributes on existing user

I was able to get this resolved by supplying additional details in my PUT request:
{
"posixAccounts": [
{
"username": "email(excluding #domain.com)",
"uid": "1234",
"gid": "12345",
"operatingSystemType": "unspecified",
"shell": "/bin/bash",
"gecos": "Firstname Lastname"
"systemId": ""
}
]
}
The above wouldn't reflect in LDAP until I put "systemId" in there. So that part is required.

Related

Ember 4.1. Django rest json api. Access field choices from OPTIONS request in Ember data model or elsewhere

My DRF JSON API backend responds with a JSON on OPTIONS request.
The OPTIONS response includes field choices declared on Django model.
On my frontend, in my Ember 4.1 app with default JSONApiAdapter I want to use these exact same choices on my form select. Is there a way to access these choices on my Ember model or somewhere else? and if so, How do I do it?
Here's an example OPTIONS response:
{
"data": {
"name": "Names List",
"description": "API endpoint for Names",
"renders": [
"application/vnd.api+json",
"text/html"
],
"parses": [
"application/vnd.api+json",
"application/x-www-form-urlencoded",
"multipart/form-data"
],
"allowed_methods": [
"GET",
"POST",
"HEAD",
"OPTIONS"
],
"actions": {
"POST": {
"name": {
"type": "String",
"required": true,
"read_only": false,
"write_only": false,
"label": "Name",
"help_text": "name",
"max_length": 255
},
"name-type": {
"type": "Choice",
"required": true,
"read_only": false,
"write_only": false,
"label": "Name type",
"help_text": "Name type",
"choices": [
{
"value": "S",
"display_name": "Short"
},
{
"value": "L",
"display_name": "Long"
]
}
}
}
}
}

List users as non admin with custom fields

As per the documentation, I should be able to get a list of users with a custom schema as long as the field in the schema has a value of ALL_DOMAIN_USERS in the readAccessType property. That is the exact set up I have in the admin console; Moreover, when I perform a get request to the schema get endpoint for the schema in question, I get confirmation that the schema fields are set to ALL_DOMAIN_USERS in the readAccessType property.
The problem is when I perform a users list request, I don't get the custom schema in the response. The request is the following:
GET /admin/directory/v1/users?customer=my_customer&projection=full&query=franc&viewType=domain_public
HTTP/1.1
Host: www.googleapis.com
Content-length: 0
Authorization: Bearer fakeTokena0AfH6SMD6jF2DwJbgiDZ
The response I get back is the following:
{
"nextPageToken": "tokenData",
"kind": "admin#directory#users",
"etag": "etagData",
"users": [
{
"externalIds": [
{
"type": "organization",
"value": "value"
}
],
"organizations": [
{
"department": "department",
"customType": "",
"name": "Name",
"title": "Title"
}
],
"kind": "admin#directory#user",
"name": {
"fullName": "Full Name",
"givenName": "Full",
"familyName": "Name"
},
"phones": [
{
"type": "work",
"value": "(999)999-9999"
}
],
"thumbnailPhotoUrl": "https://photolinkurl",
"primaryEmail": "user#domain.com",
"relations": [
{
"type": "manager",
"value": "user#domain.com"
}
],
"emails": [
{
"primary": true,
"address": "user#domain.com"
}
],
"etag": "etagData",
"thumbnailPhotoEtag": "photoEtagData",
"id": "xxxxxxxxxxxxxxxxxx",
"addresses": [
{
"locality": "Locality",
"region": "XX",
"formatted": "999 Some St Some State 99999",
"primary": true,
"streetAddress": "999 Some St",
"postalCode": "99999",
"type": "work"
}
]
}
]
}
However, if I perform the same request with a super admin user, I get an extra property in the response:
"customSchemas": {
"Dir": {
"fieldOne": false,
"fieldTwo": "value",
"fieldThree": value
}
}
My understanding is that I should get the custom schema with a non admin user as long as the custom schema fields are set to be visible by all domain users. This is not happening. I opened a support ticket with G Suite but the guy that provided "support", send me in this direction. I believe this is a bug or maybe I overlooked something.
I contacted G Suite support and in fact, this issue is a domain specific problem.
It took several weeks for the issue to be addressed by the support engineers at Google but it was finally resolved. The behaviour is the intended one now.

Creating an eBay fulfilment policy. ("Please select a valid postage service.")

After a day of work with Postman, I have managed to reduce the number of errors down to 1. No idea how to get past it.
Definitely not an authorisation problem. I've been making lots of authorised calls.
URI:
POST https://api.ebay.com/sell/account/v1/fulfillment_policy
Body:
{
"categoryTypes": [
{
"name": "ALL_EXCLUDING_MOTORS_VEHICLES"
}
],
"freightShipping": "false",
"globalShipping": "false",
"handlingTime": {
"unit": "DAY",
"value": "1"
},
"localPickup": "true",
"marketplaceId": "EBAY_AU",
"name": "100 grams",
"shippingOptions": [
{
"costType": "CALCULATED",
"optionType": "DOMESTIC",
"shippingServices": [
{
"shippingCarrierCode": "Australia Post",
"shippingServiceCode": "AU_Regular"
}
]
}
]
}
Output:
{
"errors": [
{
"errorId": 20403,
"domain": "API_ACCOUNT",
"category": "REQUEST",
"message": "Invalid .",
"longMessage": "Please select a valid postage service.",
"inputRefIds": [
"service"
],
"parameters": [
{
"name": "XPATH",
"value": "DomesticItemShippingService[0].shippingService"
}
]
}
]
}
Things I've Tried:
Deleting "shippingOptions": [...] (and everything inside the []s) got rid of the errors and resulted in the successful creation of a new fulfillment policy. However, I wanted to include shipping options in my call.
shippingCarrierCode doesn't seem to do anything. I've changed it to all sorts of sensible and non sensible things, including deleting it entirely. No impact on the output.
Changing shippingServiceCode to anything non-standard (eg "shippingServiceCode": "potato") results in getting the exact same error, but twice instead of once. (See below) How can I get the same error twice with only one shipping option?
Including a domestic and international option, I get the same error twice also. (Same output as below, except the second DomesticItemShippingService[1].shippingService is instead DomesticItemShippingService[0].shippingService)
Making an international option AND a domestic option, BOTH with silly service names results in 3 errors. (I was expecting 4.)
Code:
{
"errors": [
{
"errorId": 20403,
"domain": "API_ACCOUNT",
"category": "REQUEST",
"message": "Invalid .",
"longMessage": "Please select a valid postage service.",
"inputRefIds": [
"service"
],
"parameters": [
{
"name": "XPATH",
"value": "DomesticItemShippingService[0].shippingService"
}
]
},
{
"errorId": 20403,
"domain": "API_ACCOUNT",
"category": "REQUEST",
"message": "Invalid .",
"longMessage": "Please select a valid postage service.",
"inputRefIds": [
"service"
],
"parameters": [
{
"name": "XPATH",
"value": "DomesticItemShippingService[1].shippingService"
}
]
}
]
}
What did I do wrong this time?
I did get an answer to my question. Not here, even though I sent them the link here, but I got the answer (eventually) through official eBay channels.
I'll post that answer here for everyone. I was thinking of adding correct stackoverflow formatting, but decided it would be better to leave the correct answer untouched from the original.
Hello Jonathon ,
Ignore my last message and Apologize for the confusion.
Here is the reason why you are getting the error:
You have to set "localPickup": "false", refer doc for your help:
https://developer.ebay.com/api-docs/sell/account/resources/fulfillment_policy/methods/createFulfillmentPolicy#request.localPickup
And you will get response as:
{ "name": "100 grams", "marketplaceId": "EBAY_AU",
"categoryTypes": [
{
"name": "ALL_EXCLUDING_MOTORS_VEHICLES",
"default": true
} ], "handlingTime": {
"value": 1,
"unit": "DAY" }, "shippingOptions": [
{
"optionType": "DOMESTIC",
"costType": "CALCULATED",
"shippingServices": [
{
"sortOrder": 1,
"shippingCarrierCode": "Australia Post",
"shippingServiceCode": "AU_Regular",
"freeShipping": false,
"buyerResponsibleForShipping": false,
"buyerResponsibleForPickup": false
}
],
"insuranceOffered": false,
"insuranceFee": {
"value": "0.0",
"currency": "AUD"
}
} ], "globalShipping": false, "pickupDropOff": false, "freightShipping": false, "fulfillmentPolicyId": "6104871000",
"warnings": [] }
Let us know if you need further assistance!!!
Best Regards, eBay Developer Support
Check them out here. Make sure you have all the required fields.
pickupDropOff
shippingOptions.shippingServices.shipToLocations.regionIncluded

User model giving email validation error in loopback3

I have created a model MyUser based on the User model as follows:
{
"name": "MyUser",
"base": "User",
"idInjection": true,
"options": {
"validateUpsert": true
},
"ownerRelations": true,
"emailVerificationRequired": true,
"hidden": [
"email",
"emailVerified"
],
"properties": {
"firstName": {
"type": "string",
"required": true
},
"lastName": {
"type": "string",
"required": true
},
"email": {
"type": "string",
"required": true
}
},
"validations": [],
"relations": {
"accessTokens": {
"type": "hasMany",
"model": "CustomAccessToken",
"polymorphic": {
"foreignKey": "userId",
"discriminator": "principalType"
},
"options": {
"disableInclude": true
}
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
},
{
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW",
"property": "create"
}
],
"methods": {}
}
It works perfectly on my local server. But when I host it on aws ec2, only the first time user is created. Next time even if I give different email id, I get email verification error as follows:
The 'MyUser' instance is not valid. Details:emailEmail already exists (value: undefined).
Now if I delete the 1st record and try to create user, it works. So, only 1st record is getting inserted and post that for any unique email also, I am getting validation error. I am not sure why this is happening.
I was able to figure out the problem. I have kept email as a hidden field. loopback has "prohibitHiddenPropertiesInQuery": true by default which does not allow hidden properties in query. As a result, during user validation, email was ignored in the query in loopback-juggler/lib/validation.js. Upon setting prohibitHiddenPropertiesInQuery to false, it works.
However, I am still not sure why it was working in development mode on my local server. prohibitHiddenPropertiesInQuery is by default true, so it should not have worked in development mode also. If anyone have any answer to this, please do let me know.

strongloop loopback id getting sent to the user owning the object

I have a strongloop app in which I am trying to post some data to my REST APIs and then trying to retrieve it from another user but I am not getting the "id" of that record to the user not owning the object. How do I access the generated "id" from the user not owning the object. There are no ACLs in my model file
I am expecting the generated unique user identifiers to be returned along with the json response, for example if I make a request like this -
http://localhost:80/api/tuitions?access_token=qvpvtsbWOLZYydUDcbO0VP6YrlfHhbURHpkvPjnUyU9wRHpclAyJh44RKJ6VU36x
the output is -
[
{
"area": [
"901"
],
"city": "9",
"class": "9",
"subjects": [
"902"
],
"userId": "5696915dec62196433db7950",
"created": "2016-01-14T18:40:07.761Z",
"updated": "2016-01-14T18:40:07.761Z",
"identifier": "5697eb8767e585347755c23b"
}
]
in my loopback explorer and my loopback tuition model file defines identifier as -
{
"name": "tuition",
"base": "PersistedModel",
"strict": false,
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
// ...
"identifier": {
"type": "string",
"id": true
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
But when I make the same request with my Angular App in my controller with something like -
Tuition.find({
filter: {
order: 'created DESC'
}
}).$promise;
I get this -
[{"area":["901"],"city":"9","class":"9","subjects":["902"],"userId":"5696915dec62196433db7950","created":"2016-01-14T18:40:07.761Z","updated":"2016-01-14T18:40:07.761Z"}]
which does not have identifier