I'm migrating an app from Parse.com (hosted) to a self-hosted* Parse Server implementation (https://github.com/ParsePlatform/parse-server).
My app relies heavily on Class-Level Permissions so that, for example, global settings can be read by all users with the public key but not edited or deleted without the master key.
On Parse.com these permissions are configurable in the dashboard, but the open source Parse Server doesn't have a dashboard. Maybe there's some way to do this using cloud code?
*I'm using App Engine's managed VM environment although I'm not sure that's relevant.
Using Rest API:
// POST http://my-parse-server.com/schemas/Announcement
// Set the X-Parse-Application-Id and X-Parse-Master-Key header
// body:
{
classLevelPermissions:
{
"find": {
"requiresAuthentication": true,
"role:admin": true
},
"get": {
"requiresAuthentication": true,
"role:admin": true
},
"create": { "role:admin": true },
"update": { "role:admin": true },
"delete": { "role:admin": true }
}
}
Ref:
https://docs.parseplatform.org/rest/guide/#requires-authentication-permission-requires-parse-server---230
https://docs.parseplatform.org/rest/guide/#class-level-permissions
I found the _SCHEMA table in the mongodb datastore and it contains the CLPs I was looking for. Apparently that's where they're stored and they were migrated along with the rest of my data from Parse.com. I've confirmed that updating those values affects data access permissions
Related
I'm new to Strapi and Following Strapi Tutorial Playlist in Youtube.Youtube Playlist is old and He is using Strapi V3. But Current Version is 4.0.5. I facing problem in using API Endpoint.
I created Collection type and named it as Posts.I even published it.When I navigate to http://localhost:1337/api/posts, It returns
{
"data": null,
"error": {
"status": 403,
"name": "ForbiddenError",
"message": "Forbidden",
"details": {}
}
}
Does somebody help me please?
If you try to retrieve the data as a public user, then you need to go to roles and set the appropriate rights.
Settings -> Users & Permissions -> Roles -> Public -> Posts
then make sure find and fineone are checked.
For me, the problem was that I needed to set a scope for the auth configs of the route.
Like this (please note the scope):
routes: [
{
method: 'GET',
path: '/custom-route',
handler: 'custom-controller.getCustomMethod',
config: {
policies: [],
auth: {
scope: ['find'],
},
},
},
],
I have added an extended property to a Google calendar entry and been able to read it back successfully. The format of the json is like this:
"extendedProperties": {
"private": {
"MyPropertyName": "yes"
}
},
I want to do the same thing to created Task entries and contact entries (via the People API). With the People API, trying to create the entry results in http 400. With the Task API, it accepts the json, but the property is not returned when I retrieve the task.
Is it possible to do what I want with the current versions of the People and Task API?
In People API extended properties are called ClientData
The json structure of the resouce is:
{
"metadata": {
object (FieldMetadata)
},
"key": string,
"value": string
}
with FieldMetadata:
{
"primary": boolean,
"sourcePrimary": boolean,
"verified": boolean,
"source": {
object (Source)
}
}
So, I am new to Android Studio. I'm following an online course step by step.
I'm using ParseServer on AWS. I've managed to get my appId, etc. and can connect with a Java SSH Client directly from my browser. My app can successfully store information in the ParseServer, but I can't access the parse dashboard. When I try to it asks me to enter my username and password -- which I don't have.
I've found a file (in bitnami terminal) and I think that I should maybe make myself an account in here?
# /home/bitnami/apps/parse/.forever/config.json
{
"root": "/opt/bitnami/apps/parse/.forever",
"pidPath": "/opt/bitnami/apps/parse/.forever/pids",
"sockPath": "/opt/bitnami/apps/parse/.forever/sock",
"loglength": 100,
"logstream": false,
"columns": [
"uid",
"command",
"script",
"forever",
"pid",
"id",
"logfile",
"uptime"
]
}
The issue lays with wherever you're instantiating the dashboard. For me, this is inside index.js.
var dashboard = new ParseDashboard({
"apps": [
{
"serverURL": process.env.SERVER_URL,
"appId": process.env.APP_ID,
"masterKey": process.env.MASTER_KEY,
"appName": process.env.APP_NAME,
"javascriptKey": process.env.JS_KEY,
}
],
"users": [
{
"user":<username>,
"pass":<password>
}
],
"useEncryptedPasswords": true, //Requires Bcrypt encrypted passwords. Set to false if you want the explicit <password> plain text string to be your password)
"trustProxy": 1
});
Thansk for answering my question!
The right answer is to find here: https://docs.bitnami.com/aws/faq/#how-to-find-application-credentials:
Username: user
Password: -> On EC2 / Amazon you must go this way: Instance Settings -> Get System Log -> Look for your password, which was given from system by setup
That's all!
I have setup an Alexa Smart Home Skill, all settings done, oauth2 processed done and skill is enabled on my Amazon Echo device. Lambda function is setup and linked to the skill. When I "Discover Devices" I can see the payload hit my Lambda function in the log. I am literally returning via the context.succeed() method the following JSON with a test appliance. However Echo tells me that it fails to find any devices.
{
"header": {
"messageId": "42e0bf9c-18e2-424f-bb11-f8a12df1a79e",
"name": "DiscoverAppliancesResponse",
"namespace": "Alexa.ConnectedHome.Discovery",
"payloadVersion": "2"
},
"payload": {
"discoveredAppliances": [
{
"actions": [
"incrementPercentage",
"decrementPercentage",
"setPercentage",
"turnOn",
"turnOff"
],
"applianceId": "0d6884ab-030e-8ff4-ffffaa15c06e0453",
"friendlyDescription": "Study Light connected to Loxone Kit",
"friendlyName": "Study Light",
"isReachable": true,
"manufacturerName": "Loxone",
"modelName": "Spot"
}
]
}
}
Does the above payload look correct?
According to https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/smart-home-skill-api-reference#discovery-messages the version attribute is required. Your response seems to be missing that attribute.
In my (very short) experience with this, even the smallest mistake in the response would generate a silent error like the one you are experiencing.
I had the same problem. If you are creating discovery for "Entertainment Device", make sure you have wrapped the output in 'event' key for context.succeed
var payload = {
endpoints:
[
{
"endpointId": "My-id",
"manufacturerName": "Manufacturer",
"friendlyName": "Living room TV",
"description": "65in LED TV from Demo AV Company",
"displayCategories": [ ],
"cookie": {
"data": "e.g. ip address",
},
"capabilities":
[
{
"interface": "Alexa.Speaker",
"version": "1.0",
"type": "AlexaInterface"
},
]
}
]
};
var header = request.directive.header;
header.name = "Discover.Response";
context.succeed({ event: {
header: header, payload: payload
} });
Although, in the sample code, this is never mentioned and an incorrect example is given (https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/steps-to-create-a-smart-home-skill). However, the response body provided includes the "event" key.
Recreating lambda function helped me fix the issue. I also set "Enable trigger" check button while creating, though I'm not sure if that matters. After that my device provided by skill was found successfully.
Edit: Answer was wrong. Only useful information was this
This context.fail syntax is actually deprecated. Look up the Lambda context object properties, it should look more like "callback(null, resultObj)" now.
Did you include the return statement in your function?
return {
"header": header,
"payload": payload
}
It was missing in the example and after adding it, I was able to 'discover' my device.
I use GCE V1 rest api to launch instances. I rarely use google developer console. I created windows VM instance through rest api. I passed windows initial username and password in metadata property. Windows VM created successfully. I also able to get those credentials in response, which I sent while creating VM. But I couldn't connect the VM using that username and password. I read the doc about how to reset password from developer console. It works fine. But we would like to rest apis for all. I mean to created/manage GCE resources. So can anyone help to fix this issue?
The image I used to launch a vm is "windows-server-2012-r2-dc-v20150511"
"metadata": {
"items": [
{
"key": "gce-initial-windows-user",
"value": "administrator"
},
{
"key": "gce-initial-windows-password",
"value": "twxsFL3U-/,*"
}
]
}
Note: I created many VMs through rest api. All instances have the same issue. When reseting the password from developer console, it works.
The credentials didn't work. I am able to reset them from developer console. But that will not fix my problem. Because we have our own system to launch VMs and other services. For that I'm building a connector. Here is the sample request I send from node.js script.
Request :
***********
options : {
"host": "www.googleapis.com",
"path": "/compute/v1/projects/project-id/zones/us-central1-f/instances",
"method": "POST",
"headers": {
"Authorization": "Bearer ya29.lQGsX8hwdWKaDDwOFnDIZB49eir-c2TUBqYpaVvir7C430Quy8kIWsL4rXv7qjSVQZJKK5e1BdxNug",
"Content-Type": "application/json charset=utf-8"
}
}
body : {
"name": "rin2qvxkz-e",
"zone": "https://www.googleapis.com/compute/v1/projects/project-id/zones/us-central1-f",
"machineType": "https://www.googleapis.com/compute/v1/projects/project-id/zones/us-central1-f/machineTypes/n1-standard-2",
"metadata": {
"items": [
{
"key": "gce-initial-windows-user",
"value": "administrator"
},
{
"key": "gce-initial-windows-password",
"value": "%1zuV27$.:?*"
}
]
},
"tags": {
"items": [
"default"
]
},
"disks": [
{
"type": "PERSISTENT",
"boot": true,
"mode": "READ_WRITE",
"deviceName": "rin2qvxkz-e",
"autoDelete": true,
"initializeParams": {
"sourceImage": "https://www.googleapis.com/compute/v1/projects/windows-cloud/global/images/windows-server-2012-r2-dc-v20150511",
"diskType": "https://www.googleapis.com/compute/v1/projects/project-id/zones/us-central1-f/diskTypes/pd-standard"
}
}
],
"canIpForward": false,
"networkInterfaces": [
{
"network": "https://www.googleapis.com/compute/v1/projects/project-id/global/networks/default",
"accessConfigs": [
{
"name": "External NAT",
"type": "ONE_TO_ONE_NAT"
}
]
}
],
"description": "rin2qvxkz-e",
"scheduling": {
"preemptible": false,
"onHostMaintenance": "MIGRATE",
"automaticRestart": true
}
}
Thanks.
You are using a new Windows image "windows-server-2012-r2-dc-v20150511" with an updated GCEAgent that doesn't look at the gce-initial-windows-user/gce-initial-windows-password instance metadata keys which were used by the old authentication scheme.
Here are explanations of how the new authentication works, starting from the "windows-server-2012-r2-dc-v20150511" image and onwards.
Please note that the initial Windows authentication and GCE API v1 are two separate topics and GCE API v1 has not changed as part of the authentication update.
The earlier answer didn't really explain when this changed. I did more research and found a note in the change log for Google Windows Images.
Metadata items gce-initial-windows-user and gce-initial-windows-password will no longer work for images v20150511 and later
https://cloud.google.com/compute/docs/release-notes-archive#february_2015
June 03, 2015
Updated Windows authentication process. Windows images v20150511 and
later will use the new scheme by default. gcloud will now generate a
random password for Windows login; it is no longer possible to
manually set a Windows password through gcloud but you can set a
custom password in the instance.
Here are some links that detail how to Add users to windows Images now
You can use the gcloud command line tool
https://cloud.google.com/sdk/gcloud/reference/compute/reset-windows-password
gcloud compute reset-windows-password INSTANCE_NAME [--user=USER]
[--zone=ZONE] [GCLOUD_WIDE_FLAG …]
You can call the API, They give GO and Python examples
They also detail a Step-By-Step manual process, in case you want more details
https://cloud.google.com/compute/docs/instances/windows/automate-pw-generation