The official blog mentioned setting class-level permissions through the data browser.
http://blog.parse.com/2014/07/07/parse-security-ii-class-hysteria/
Is there any way to do the same through CLI or Cloud Code?
It's needed for the automation of the installation process of our app on Parse.com.
Unfortunately those features are only available from the Data Browser.
Sounds like it could be an interesting feature request. I'm not sure if there's an official channel for making feature requests (maybe a bug report?) but you could try the Google Group page, you can find the link here:
https://parse.com/help/
You can invoke REST API like they mention here.
http://parseplatform.github.io/docs/js/guide/#pointer-permissions
(this was also obtained by looking at the inspector Parse Dashboard)
//POST http://localhost:8000/parse/schemas/Post
{
"classLevelPermissions": {
"get": {
"*": true,
"role:admin": true
},
"find": {
"*": true,
"role:admin": true
},
"create": {
"role:admin": true
},
"update": {
"role:admin": true
},
"delete": {
"role:admin": true
},
"addField": {
"*": true,
"role:admin": true
},
"readUserFields": [
"owner"
],
"writeUserFields": [
"owner"
]
},
"_method": "PUT",
"_ApplicationId": "MY_APPLICATION_ID",
"_ClientVersion": "js1.6.14",
"_MasterKey": "MY_MASTER_KEY",
"_InstallationId": "e703b6b0-c992-92af-3cf7-3b1ad09739cd"
}
Related
I have several quality gates created within sonarqube and I would like to know how to obtain the ids of each of them
On the official documentation you can find following methods:
GET api/qualitygates/get_by_project
Get the quality gate of a project.
Requires one of the following permissions:
- 'Administer System'
- 'Administer' rights on the specified project
- 'Browse' on the specified project
ParametersResponse
{
"qualityGate": {
"id": "AU-Tpxb--iU5OvuD2FLy",
"name": "My team QG",
"default": false
}
}
and
GET api/qualitygates/list
Get a list of quality gates
Response
{
"qualitygates": [
{
"id": "AU-Tpxb--iU5OvuD2FLy",
"name": "Sonar way",
"isDefault": true,
"isBuiltIn": true,
"actions": {
"rename": false,
"setAsDefault": false,
"copy": true,
"associateProjects": false,
"delete": false,
"manageConditions": false
}
},
{
"id": "AU-Tpxb--iU5OvuD2FLz",
"name": "Sonar way - Without Coverage",
"isDefault": false,
"isBuiltIn": false,
"actions": {
"rename": true,
"setAsDefault": true,
"copy": true,
"associateProjects": true,
"delete": true,
"manageConditions": true
}
}
],
"default": 8,
"actions": {
"create": true
}
}
Both of these methods will return ids.
I would first urge you to step back and describe exactly what you need to get done.
However, you can get information about quality gates and other SonarQube components from the WebAPI rest interface. Go into your SonarQube gui, go to the bottom of the page, and click on the "Web API" link. Enter "quality gate" in the filter to see information about all of the endpoints related to quality gates.
I'm developing in AWS Cloud9, and have a basic "Hello, World" API set up using Lambda.
Now I would like to iterate so that the API can accept parameters. Cloud9 used to have a convenient UI for modifying the payload when running "local" (in the IDE, without deploy). But I can't find where this has been moved, and the documentation still references the previous UI.
To test this, I've included a simple print(event) in my Lambda, and started modifying various components. So far I only print an empty dict ({}).
I suspect it's in the launch.json but so far everything I've modified has not been picked up. Showing below
{
"configurations": [
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "API token-to-geojson:HelloWorldFunction (python3.9)",
"invokeTarget": {
"target": "api",
"templatePath": "token-to-geojson/template.yaml",
"logicalId": "HelloWorldFunction"
},
"api": {
"path": "/hello",
"httpMethod": "get",
"payload": {
"json": {}
}
},
"lambda": {
"runtime": "python3.9"
}
},
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "token-to-geojson:HelloWorldFunction (python3.9)",
"invokeTarget": {
"target": "template",
"templatePath": "token-to-geojson/template.yaml",
"logicalId": "HelloWorldFunction"
},
"lambda": {
"payload": {
"ticky": "tacky"
},
"environmentVariables": {},
"runtime": "python3.9"
}
}
]
}
The only thing I saw is we need to add "json" before the actual json data. In the example below, it appears the IDE already knows the id is event.id (note event is the first argument of the handler).
"lambda": {
"payload": {
"json": {
"id": 1001
}
},
"environmentVariables": {}
}
I have a small question:
Where and how can I view a generated database query, via "Debug" or "Strapi.log.info(...)"?
Many greetings
You can in you config/environments/development/database.json file into the options object add the following "debug": true
You will be able to see all the database requests.
eg. for a SQLite database connection
{
"defaultConnection": "default",
"connections": {
"default": {
"connector": "bookshelf",
"settings": {
"client": "sqlite",
"filename": ".tmp/data.db"
},
"options": {
"useNullAsDefault": true,
"debug": true
}
}
}
}
I am new to Serverless (www.serverless.com) and learning the CLI.
I am having trouble creating a POST, PUT, or DELETE endpoint for a function. In looking at the documentation, I used the following to create a function:
sls function create mycomponent/myfunction
This worked great, and the resulting s-function.json has a 'GET' endpoint automatically added. What I would like is to be able to add 'PUT', 'POST', or 'DELETE' endpoints on some functions.
It looks like from documentation that I could use endpoint deploy, but I attempted this and it did not work:
sls endpoint deploy mycomponent/myfunction#myfunction/create~POST
This errors out saying that no such endpoint name exists (I assume because it isn't in the s-function.json file).
Do I need to hand-code the s-function.json file to include the other endpoints, or is there a way to do this through the CLI?
Thanks for your help!
I've just taken to updating the s-function.json file to set the method of an "sls" function/endpoint.
Same goes for setting specific statusCode, requestTemplates, and so on.
Here's an example of a POST function/endpoint s-function.json config file.
{
"name": "create",
"handler": "user/create/handler.handler",
"timeout": 3,
"memorySize": 128,
"custom": {
"excludePatterns": [],
"envVars": []
},
"endpoints": [
{
"path": "user/create",
"method": "POST",
"type": "AWS",
"authorizationType": "none",
"apiKeyRequired": false,
"requestParameters": {},
"requestTemplates": "$${apiRequestTemplate}",
"responses": {
"400": {
"statusCode": "400"
},
"default": {
"statusCode": "201",
"responseParameters": {},
"responseModels": {},
"responseTemplates": {
"application/json": ""
}
}
}
}
]
}
This is a newbie question. I see that the browsable API for Django rest framework is able to detect readonly fields defined in my serializer and exclude them from the HTML form that is presented to the user for PUT/POST operations.
What is the mechanism used here and can I use the same to indicate readonly fields to the remote client? I don't see any difference in the format between readonly fields and writable fields in the JSON object itself, so I'm guessing that there is some metadata involved but I couldn't find anything in the documentation.
I'm using Django version 1.7 and django-rest-framework version 3.1.3.
You should send an OPTION request to Django REST framework to get an insight of the expected content - see the option button on the browsable interface.
See the id field under the following sample:
{
"name": "Task List",
"description": "",
"renders": [
"application/json",
"text/html"
],
"parses": [
"application/json",
"application/x-www-form-urlencoded",
"multipart/form-data"
],
"actions": {
"POST": {
"id": {
"type": "integer",
"required": false,
"read_only": true,
"label": "ID"
},
"name": {
"type": "string",
"required": true,
"read_only": false,
"label": "Name",
"max_length": 64
},
"owner": {
"type": "field",
"required": true,
"read_only": false,
"label": "Owner",
"choices": [
{
"display_name": "admin",
"value": "admin"
},
{
"display_name": "cody",
"value": "cody"
}
]
}
}
}
}
U should use django-swagger, it is an app to document django rest framework APIs.
In you serializer field, you can set a help text, you can use it to mark as read only field the your client should read that on APIs document.