ONLYOFFICE when url and callbackUrl have diffent [example.com] - onlyoffice

{
"document": {
"fileType": "docx",
"key": "Khirz6zTPdfd7",
"permissions": {
"download": true,
"edit": true,
"print": true,
"review": true
},
"title": "Example Document Title.docx",
"url": "https://aaaa.com/url-to-example-document.docx"
},
"editorConfig": {
"callbackUrl": "https://bbbb.com/url-to-callback.ashx",
"mode": "edit",
"user": {
"group": "Group1",
"id": "78e1e841",
"name": "Smith"
}
}
}
//when zhe url and callbackUrl are different ,zhe url is the oss file,but zhe callbackUrl is my //site,when i edited,my callbackUrl cant receive any request,but when i open i can receive.

{
"document": {
"fileType": "docx",
"key": "Khirz6zTPdfd7",
"permissions": {
"download": true,
"edit": true,
"print": true,
"review": true
},
"title": "Example Document Title.docx",
"url": "https://example.com/url-to-example-document.docx"
},
"editorConfig": {
"callbackUrl": "https://example.com/url-to-callback.ashx",
"mode": "edit",
"user": {
"group": "Group1",
"id": "78e1e841",
"name": "Smith"
}
}
}json

Related

Sentinel bookmark create-or-update API not able to link the bookmark to an incident

I'm trying to create a new bookmark and link it to an incident:
PUT https://management.azure.com/subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.OperationalInsights/workspaces/<workspaceName>/providers/Microsoft.SecurityInsights/bookmarks/<bookmarkId>?api-version=2022-11-01
Headers:
Content-Type : application/json
Body:
{
"properties": {
"displayName": "SigninLogs - APIAPI",
"query": "SigninLogs",
"incidentInfo": {
"incidentId": "<incidentId>",
"title": "TESTINC",
"relationName": "xxx",
"severity": "Medium"
}
}
}
The bookmark is successfully created but it's not linked to the incident :
Response Code: 200
{
"id": "xxxxxx",
"name": "xxxxx",
"etag": "xxxx",
"type": "Microsoft.SecurityInsights/Bookmarks",
"properties": {
"displayName": "SigninLogs - APIAPI",
"created": "2023-02-08T14:59:04.7430164+00:00",
"updated": "2023-02-09T09:46:29+00:00",
"createdBy": {
"objectId": "xxxxx",
"email": "xxxx",
"name": "xxxx"
},
"updatedBy": {
"objectId": "xxxxxx",
"email": "xxxxx",
"name": "xxxxx"
},
"eventTime": "2023-02-09T09:46:29.0395695+00:00",
"labels": [],
"query": "SigninLogs",
"incidentInfo": {
"incidentId": null,
"title": null,
"relationName": null,
"severity": null
}
}
}

Sharepoint REST API - post comment on behalf of another user

There is a way of how to add comments to Sharepoint site using REST API. It is explained here https://beaucameron.com/2021/01/18/add-comments-to-sharepoint-list-items-using-the-rest-api/ for example.
But when I add comment like this, it adds it on behalf of my name - because REST endpoint is accessed using access token, which is linked to my e-mail.
I'd like to migrate comments from one site to the other, and keep original authors.
Is there a way to post comments on behalf of other users?
I tried this POST body:
{
"__metadata": {
"type": "Microsoft.SharePoint.Comments.comment"
},
"text": "Some new comment",
"author": {
"__metadata": {
"type": "SP.Sharing.Principal"
},
"email": "AlexW#OnMicrosoft.com",
"id": 18,
"loginName": "i:0#.f|membership|alexw#onmicrosoft.com",
"name": "Alex Wilber",
"principalType": 1
}
}
But still, comment is posted on behalf of my name. The response is like the following:
{
"d": {
"__metadata": {
"id": "https://sharepoint.com/_api/web/lists('017dd808-5a37-4d65-89f9-b5ce994554b4')/GetItemById(1)/Comments(15)",
"uri": "https://sharepoint.com/_api/web/lists('017dd808-5a37-4d65-89f9-b5ce994554b4')/GetItemById(1)/Comments(15)",
"type": "Microsoft.SharePoint.Comments.comment"
},
"likedBy": {
"__deferred": {
"uri": "https://sharepoint.com/_api/web/lists('017dd808-5a37-4d65-89f9-b5ce994554b4')/GetItemById(1)/Comments(15)/likedBy"
}
},
"replies": {
"__deferred": {
"uri": "https://sharepoint.com/_api/web/lists('017dd808-5a37-4d65-89f9-b5ce994554b4')/GetItemById(1)/Comments(15)/replies"
}
},
"author": {
"__metadata": {
"type": "SP.Sharing.Principal"
},
"email": "myName.mySurname#onmicrosoft.com",
"expiration": null,
"id": 12,
"isActive": true,
"isExternal": false,
"jobTitle": null,
"loginName": "i:0#.f|membership|myName.mySurname#onmicrosoft.com",
"name": "myName mySurname",
"principalType": 1,
"userId": null,
"userPrincipalName": null
},
"createdDate": "2022-05-24T08:40:19.0841947Z",
"id": "15",
"isLikedByUser": false,
"isReply": false,
"itemId": 1,
"likeCount": 0,
"listId": "017dd808-5a37-4d65-89f9-b5ce994554b4",
"mentions": null,
"parentId": "0",
"replyCount": 0,
"text": "Some new comment"
}
}
So still, I'm the author of the comment...

Mongoose pluck document array

I have a document like this:
I have a schema design like this, I'm using mongoose-paginate-v2:
const options = {
select: 'files',
lean: true,
offset,
limit
};
const data = Message.paginate(
{ conversation_id: conversationId, 'files.category': { "$in" : category } },
options,
);
return data;
This is my response data:
[
{
"_id": "628472b3ef39fbb8bb655317",
"files": [
{
"src": "U21102500080/2022/5/images/1652847282675-pexels_02.jpeg",
"name": "pexels_02.jpeg",
"extension": "jpeg",
"size": 25708,
"category": "image",
"_id": "628472b3ef39fbb8bb655318"
},
{
"src": "U21102500080/2022/5/images/1652847282704-pexels_03.jpeg",
"name": "pexels_03.jpeg",
"extension": "jpeg",
"size": 107748,
"category": "image",
"_id": "628472b3ef39fbb8bb655319"
},
{
"src": "U21102500080/2022/5/images/1652847282704-pexels_01.jpeg.jpeg",
"name": "pexels_01.jpeg.jpeg",
"extension": "jpeg",
"size": 22364,
"category": "image",
"_id": "628472b3ef39fbb8bb65531a"
}
],
"id": "628472b3ef39fbb8bb655317"
},
{
"_id": "628702c293b660628e95124d",
"files": [
{
"src": "c6ed8c14-bcec-4739-bdf2-2392c7d15318/2022/5/images/1653015230055-pexels-photo-11427585.jpeg",
"name": "pexels-photo-11427585.jpeg",
"extension": "jpeg",
"size": 17000,
"category": "image",
"_id": "628702c293b660628e95124e"
},
{
"src": "c6ed8c14-bcec-4739-bdf2-2392c7d15318/2022/5/images/1653015230098-chen-sithyfong-1fSRYz5QpSE-unsplash.jpeg",
"name": "chen-sithyfong-1fSRYz5QpSE-unsplash.jpeg",
"extension": "jpeg",
"size": 174722,
"category": "image",
"_id": "628702c293b660628e95124f"
},
{
"src": "c6ed8c14-bcec-4739-bdf2-2392c7d15318/2022/5/images/1653015230098-screen-post-EC5kTElGfNs-unsplash.jpeg",
"name": "screen-post-EC5kTElGfNs-unsplash.jpeg",
"extension": "jpeg",
"size": 160266,
"category": "image",
"_id": "628702c293b660628e951250"
}
],
"id": "628702c293b660628e95124d"
},
{
"_id": "628702fa93b660628e951275",
"files": [
{
"src": "U21102500080/2022/5/images/1653015288963-2022-01-26 16.58.29.jpg",
"name": "2022-01-26 16.58.29.jpg",
"extension": "jpg",
"size": 34576,
"category": "image",
"_id": "628702fa93b660628e951276"
},
{
"src": "U21102500080/2022/5/images/1653015288968-2022-01-26 16.58.20.jpg",
"name": "2022-01-26 16.58.20.jpg",
"extension": "jpg",
"size": 31982,
"category": "image",
"_id": "628702fa93b660628e951277"
},
{
"src": "U21102500080/2022/5/images/1653015288968-2022-01-26 16.58.24.jpg",
"name": "2022-01-26 16.58.24.jpg",
"extension": "jpg",
"size": 119198,
"category": "image",
"_id": "628702fa93b660628e951278"
}
],
"id": "628702fa93b660628e951275"
},
]
But I want this response data:
[
{
"src": "",
"name": "",
"extension": "",
"size": 0,
"category": "",
"_id": "628472b3ef39fbb8bb655318"
},
{
"src": "",
"name": "",
"extension": "",
"size": 0,
"category": "",
"_id": "628472b3ef39fbb8bb655319"
},
{
"src": "",
"name": "",
"extension": "",
"size": 0,
"category": "",
"_id": "628472b3ef39fbb8bb65531a"
},
{
"src": "",
"name": "",
"extension": "",
"size": 0,
"category": "",
"_id": "628702c293b660628e95124e"
}
]
const options = {
select: 'files',
lean: true,
offset,
limit
};
let data = Message.paginate(
{ conversation_id: conversationId, 'files.category': { "$in" : category } },
options,
);
data = data.reduce((prev,curr) => [...prev.files, ...curr.files], [] )
return data;

Hyperledger Fabric: Add new organization to existing channel using JsonPath

I want to add a new Organization to an existing Channel in Hyperledger Fabric.
First I obtain the channel configuration in JSON format using the following code snippet:
byte[] configBytes = channel.getChannelConfigurationBytes();
String configtxlator = props.getProperty("configtxlator");
HttpPost httppost = new HttpPost(configtxlator + "/protolator/decode/common.Config");
httppost.setEntity(new ByteArrayEntity(configBytes));
HttpClient httpclient = HttpClients.createDefault();
HttpResponse response = httpclient.execute(httppost);
int statuscode = response.getStatusLine().getStatusCode();
if (statuscode == 200) {
return EntityUtils.toString(response.getEntity());
} else {
return "";
}
The result is the following JSON string:
{
"channel_group": {
"groups": {
"Application": {
"groups": {
"Org1MSP": {
"groups": {},
"mod_policy": "Admins",
"policies": {
"Admins": {
"mod_policy": "Admins",
"policy": {
"type": 1,
"value": {
"identities": [
{
"principal": {
"msp_identifier": "Org1MSP",
"role": "ADMIN"
},
"principal_classification": "ROLE"
}
],
"rule": {
"n_out_of": {
"n": 1,
"rules": [
{
"signed_by": 0
}
]
}
},
"version": 0
}
},
"version": "0"
},
"Readers": {
"mod_policy": "Admins",
"policy": {
"type": 1,
"value": {
"identities": [
{
"principal": {
"msp_identifier": "Org1MSP",
"role": "ADMIN"
},
"principal_classification": "ROLE"
},
{
"principal": {
"msp_identifier": "Org1MSP",
"role": "PEER"
},
"principal_classification": "ROLE"
},
{
"principal": {
"msp_identifier": "Org1MSP",
"role": "CLIENT"
},
"principal_classification": "ROLE"
}
],
"rule": {
"n_out_of": {
"n": 1,
"rules": [
{
"signed_by": 0
},
{
"signed_by": 1
},
{
"signed_by": 2
}
]
}
},
"version": 0
}
},
"version": "0"
},
"Writers": {
"mod_policy": "Admins",
"policy": {
"type": 1,
"value": {
"identities": [
{
"principal": {
"msp_identifier": "Org1MSP",
"role": "ADMIN"
},
"principal_classification": "ROLE"
},
{
"principal": {
"msp_identifier": "Org1MSP",
"role": "CLIENT"
},
"principal_classification": "ROLE"
}
],
"rule": {
"n_out_of": {
"n": 1,
"rules": [
{
"signed_by": 0
},
{
"signed_by": 1
}
]
}
},
"version": 0
}
},
"version": "0"
}
},
"values": {
"AnchorPeers": {
"mod_policy": "Admins",
"value": {
"anchor_peers": [
{
"host": "peer1.org1.isprint.com",
"port": 7051
},
{
"host": "peer2.org1.isprint.com",
"port": 7051
}
]
},
"version": "0"
},
"MSP": {
"mod_policy": "Admins",
"value": {
"config": {
"admins": [],
"crypto_config": {
"identity_identifier_hash_function": "SHA256",
"signature_hash_family": "SHA2"
},
"fabric_node_ous": {
"admin_ou_identifier": {
"certificate": "...",
"organizational_unit_identifier": "admin"
},
"client_ou_identifier": {
"certificate": "...",
"organizational_unit_identifier": "client"
},
"enable": true,
"orderer_ou_identifier": {
"certificate": "...",
"organizational_unit_identifier": "orderer"
},
"peer_ou_identifier": {
"certificate": "...",
"organizational_unit_identifier": "peer"
}
},
"intermediate_certs": [],
"name": "Org1MSP",
"organizational_unit_identifiers": [],
"revocation_list": [],
"root_certs": [
"..."
],
"signing_identity": null,
"tls_intermediate_certs": [],
"tls_root_certs": [
"..."
]
},
"type": 0
},
"version": "0"
}
},
"version": "1"
}
},
"mod_policy": "Admins",
"policies": {
"Admins": {
"mod_policy": "Admins",
"policy": {
"type": 3,
"value": {
"rule": "MAJORITY",
"sub_policy": "Admins"
}
},
"version": "0"
},
"Readers": {
"mod_policy": "Admins",
"policy": {
"type": 3,
"value": {
"rule": "ANY",
"sub_policy": "Readers"
}
},
"version": "0"
},
"Writers": {
"mod_policy": "Admins",
"policy": {
"type": 3,
"value": {
"rule": "ANY",
"sub_policy": "Writers"
}
},
"version": "0"
}
},
"values": {
"Capabilities": {
"mod_policy": "Admins",
"value": {
"capabilities": {
"V1_4_2": {}
}
},
"version": "0"
}
},
"version": "1"
},
"Orderer": {
"groups": {
"OrdererOrg": {
"groups": {},
"mod_policy": "Admins",
"policies": {
"Admins": {
"mod_policy": "Admins",
"policy": {
"type": 1,
"value": {
"identities": [
{
"principal": {
"msp_identifier": "OrdererMSP",
"role": "ADMIN"
},
"principal_classification": "ROLE"
}
],
"rule": {
"n_out_of": {
"n": 1,
"rules": [
{
"signed_by": 0
}
]
}
},
"version": 0
}
},
"version": "0"
},
"Readers": {
"mod_policy": "Admins",
"policy": {
"type": 1,
"value": {
"identities": [
{
"principal": {
"msp_identifier": "OrdererMSP",
"role": "MEMBER"
},
"principal_classification": "ROLE"
}
],
"rule": {
"n_out_of": {
"n": 1,
"rules": [
{
"signed_by": 0
}
]
}
},
"version": 0
}
},
"version": "0"
},
"Writers": {
"mod_policy": "Admins",
"policy": {
"type": 1,
"value": {
"identities": [
{
"principal": {
"msp_identifier": "OrdererMSP",
"role": "MEMBER"
},
"principal_classification": "ROLE"
}
],
"rule": {
"n_out_of": {
"n": 1,
"rules": [
{
"signed_by": 0
}
]
}
},
"version": 0
}
},
"version": "0"
}
},
"values": {
"MSP": {
"mod_policy": "Admins",
"value": {
"config": {
"admins": [],
"crypto_config": {
"identity_identifier_hash_function": "SHA256",
"signature_hash_family": "SHA2"
},
"fabric_node_ous": {
"admin_ou_identifier": {
"certificate": "...",
"organizational_unit_identifier": "admin"
},
"client_ou_identifier": {
"certificate": "...",
"organizational_unit_identifier": "client"
},
"enable": true,
"orderer_ou_identifier": {
"certificate": "...",
"organizational_unit_identifier": "orderer"
},
"peer_ou_identifier": {
"certificate": "...",
"organizational_unit_identifier": "peer"
}
},
"intermediate_certs": [],
"name": "OrdererMSP",
"organizational_unit_identifiers": [],
"revocation_list": [],
"root_certs": [
"..."
],
"signing_identity": null,
"tls_intermediate_certs": [],
"tls_root_certs": [
"..."
]
},
"type": 0
},
"version": "0"
}
},
"version": "0"
}
},
"mod_policy": "Admins",
"policies": {
"Admins": {
"mod_policy": "Admins",
"policy": {
"type": 3,
"value": {
"rule": "MAJORITY",
"sub_policy": "Admins"
}
},
"version": "0"
},
"BlockValidation": {
"mod_policy": "Admins",
"policy": {
"type": 3,
"value": {
"rule": "ANY",
"sub_policy": "Writers"
}
},
"version": "0"
},
"Readers": {
"mod_policy": "Admins",
"policy": {
"type": 3,
"value": {
"rule": "ANY",
"sub_policy": "Readers"
}
},
"version": "0"
},
"Writers": {
"mod_policy": "Admins",
"policy": {
"type": 3,
"value": {
"rule": "ANY",
"sub_policy": "Writers"
}
},
"version": "0"
}
},
"values": {
"BatchSize": {
"mod_policy": "Admins",
"value": {
"absolute_max_bytes": 103809024,
"max_message_count": 100,
"preferred_max_bytes": 524288
},
"version": "0"
},
"BatchTimeout": {
"mod_policy": "Admins",
"value": {
"timeout": "30s"
},
"version": "0"
},
"Capabilities": {
"mod_policy": "Admins",
"value": {
"capabilities": {
"V1_4_2": {}
}
},
"version": "0"
},
"ChannelRestrictions": {
"mod_policy": "Admins",
"value": null,
"version": "0"
},
"ConsensusType": {
"mod_policy": "Admins",
"value": {
"metadata": {
"consenters": [
{
"client_tls_cert": "...",
"host": "orderer1.isprint.com",
"port": 7050,
"server_tls_cert": "..."
},
{
"client_tls_cert": "...",
"host": "orderer2.isprint.com",
"port": 7050,
"server_tls_cert": "..."
},
{
"client_tls_cert": "...",
"host": "orderer3.isprint.com",
"port": 7050,
"server_tls_cert": "..."
}
],
"options": {
"election_tick": 10,
"heartbeat_tick": 1,
"max_inflight_blocks": 5,
"snapshot_interval_size": 20971520,
"tick_interval": "500ms"
}
},
"state": "STATE_NORMAL",
"type": "etcdraft"
},
"version": "0"
}
},
"version": "0"
}
},
"mod_policy": "Admins",
"policies": {
"Admins": {
"mod_policy": "Admins",
"policy": {
"type": 3,
"value": {
"rule": "MAJORITY",
"sub_policy": "Admins"
}
},
"version": "0"
},
"Readers": {
"mod_policy": "Admins",
"policy": {
"type": 3,
"value": {
"rule": "ANY",
"sub_policy": "Readers"
}
},
"version": "0"
},
"Writers": {
"mod_policy": "Admins",
"policy": {
"type": 3,
"value": {
"rule": "ANY",
"sub_policy": "Writers"
}
},
"version": "0"
}
},
"values": {
"BlockDataHashingStructure": {
"mod_policy": "Admins",
"value": {
"width": 4294967295
},
"version": "0"
},
"Capabilities": {
"mod_policy": "Admins",
"value": {
"capabilities": {
"V1_4_3": {}
}
},
"version": "0"
},
"Consortium": {
"mod_policy": "Admins",
"value": {
"name": "SampleConsortium"
},
"version": "0"
},
"HashingAlgorithm": {
"mod_policy": "Admins",
"value": {
"name": "SHA256"
},
"version": "0"
},
"OrdererAddresses": {
"mod_policy": "/Channel/Orderer/Admins",
"value": {
"addresses": [
"orderer1.isprint.com:7050",
"orderer2.isprint.com:7050",
"orderer3.isprint.com:7050"
]
},
"version": "0"
}
},
"version": "0"
},
"sequence": "2"
}
I have written a code snippet using JsonPath:
DocumentContext context = JsonPath.parse(json);
String pathOrg1MSP = "$.channel_group.groups.Application.groups.Org1MSP";
Map<String,Object> mapOrg1MSP = context.read(pathOrg1MSP);
Map<String,Object> mapOrg2MSP = new LinkedHashMap<String,Object>();
mapOrg1MSP.forEach((k,v) -> {
mapOrg2MSP.put(k, v);
});
String pathOrg2MSP = "$.channel_group.groups.Application.groups";
context.put(pathOrg2MSP, "Org2MSP", mapOrg2MSP);
The intention is to create an exact clone first, then change whatever values need to be changed (peers, certs etc), and then splice it into the original Json.
Would this achieve what I intend to do?
What values would I need to change to prevent any possible conflicts with existing organizations?
Generate crypto materials for Org2
Generate Org2-specific configuration materials
Fetch the latest config block from orderer, trim it down and convert it to JSON (I believe u have done this step already)
Add Org2-specific configuration materials to the JSON
Convert original JSON and newly edited JSON to protobuf format
Compute difference between the new and original block (.pb files)
Convert it to JSON format and add back header
Convert it to protobuf format
Sign transaction by Org1
For the detailed commands, you can refer to this official documentation. https://hyperledger-fabric.readthedocs.io/en/release-1.4/channel_update_tutorial.html

How to fix "it doesn't support that" when I query Alexa retrievable property

I have this endpoint with powerState and connectivity properties both retrievable:
{
"endpointId": "123",
"manufacturerName": "abc",
"friendlyName": "lamp",
"description": "lamp",
"displayCategories": [
"LIGHT"
],
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa.PowerController",
"version": "3",
"properties": {
"supported": [{
"name": "powerState"
}],
"retrievable": true
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.EndpointHealth",
"version": "3",
"properties": {
"supported": [{
"name": "connectivity"
}],
"retrievable": true
}
}
],
"cookie": {}
}
I respond to ReportState request by sending the state of both properties:
{
"context": {
"properties": [
{
"namespace": "Alexa.PowerController",
"name": "powerState",
"value": "ON",
"timeOfSample": "2019-01-10T10:17:19.99Z",
"uncertaintyInMilliseconds": 50
},
{
"namespace": "Alexa.EndpointHealth",
"name": "connectivity",
"value": {
"value": "OK"
},
"timeOfSample": "2019-01-10T10:17:19.90Z",
"uncertaintyInMilliseconds": 50
}
]
},
"event": {
"header": {
"namespace": "Alexa",
"name": "StateReport",
"payloadVersion": "3",
"messageId": "cde",
"correlationToken": "efg123"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "ab123"
},
"endpointId": "123",
"cookie": {}
},
"payload": {}
}
}
And I send the same context in the PowerController response.
In the Alexa app I can see my device, turn it on and off and view its state rightly. I can ask Alexa to turn on and off my device and the response in "OK", but if I try to ask:** "Is my device turned on?" ** Alexa answers that this device doesn't support that.
The skill language is Italian and PowerController documentation https://developer.amazon.com/it/docs/device-apis/alexa-powercontroller.html says that query is supported.
What am I missing?

Resources