Azure DevOps Server 2019 extension: How do I limit the work item data entry forms my custom page appears on? - json

I'm using Azure Devops Server 2019, update 1.1. My goal is to write an extension that presents a new page, but only on the user story work item data entry form and not the data entry form for a Task, Bug, Issues, etc. See screen shot
Here is the contributions section of my vss-extension.json (It's what produced the custom page in the screen shot above). I've read Extension manifest reference, but I can't find a setting related to limiting which form a new page appears on.
Does anyone know which area of the extensions architecture I need to work in to limit which forms on which a new page appears?
"contributions": [
{
"id": "sample-work-item-form-page",
"type": "ms.vss-work-web.work-item-form-page",
"description": "Custom work item form page",
"targets": [
"ms.vss-work-web.work-item-form"
],
"properties": {
"name": "Create Standard Tasks",
"uri": "workItemPage.html"
}
}
]

By reference to this doc: Extend the work item form, this web extension belongs to Azure Boards service, so it will appear in all work item pages as your mentioned doc: Extension manifest reference. Currently it is not documented to specify which work item type it appears in.
In addition, you could directly follow this doc: Customize the web layout for a work item type (Inheritance process) to add a custom page to the user story work item.

Related

How to Add File Reference to Quality Issue

Via the BIM360 API, I am able to create Quality Issues and upload files (to be used as attachments). However, even though I am calling Post Attachments (https://forge.autodesk.com/en/docs/bim360/v1/reference/http/field-issues-attachments-POST/) (and all responses are good), nothing appears on the Issue screen.
Issue screen with manually added file. How can I make my attached file appear under the References->Files section?
(Note, I saw a mention elsewhere of the relationships API, but I get a random error just calling the first "asset" API [{"title":"Forbidden","detail":"Forbidden","errorCode":"GENERAL_ERROR","type":"https://developer.api.autodesk.com/bim360/assets/v1/error-codes/GENERAL_ERROR"}])
firstly, the screenshot shows you are working with Issues in Autodesk Construction Cloud (ACC), while the API you are using is for BIM360 Issue. This API is NOT compatible with ACC.
To work with ACC Issue, the API is available at the category of ACC:
https://forge.autodesk.com/en/docs/acc/v1/reference/http/issues-issues-GET/
this blog tells more.
https://forge.autodesk.com/blog/acc-issues-api-available-preview
In the context of ACC, the attachment(references) is managed by the general API (Relationship API). In Additional Tests of Postman collection of ACC Issue API, I demoed how to add Photo with the Issue. The logic is similar.
https://github.com/Autodesk-Forge/forge-acc.issues.api-postman.collection
Firstly, use Data Management API to get the document urn. Then, use ACC Issue API to get id of one issue. finally, use Relationship API to bind them.
PUT https://developer.api.autodesk.com/bim360/relationship/v2/containers/{{project_id_without_b}}/relationships
P.s. -bim360- in the domains is just because of legacy design of the terminologies. It can work for the contexts of both BIM360 and ACC (note it is Relationship API can work within both of the contexts)
Payload:
[
{
"entities": [
{
"domain": "autodesk-bim360-issue",
"type": "issue",
"id": "{{one_issue_id}}"
},
{
"domain": "autodesk-bim360-documentmanagement",
"type": "documentlineage",
"id": "{{one_document_urn}}"
}
]
}
]

How to structure a MediaWiki and Cargo query in Visual Basic

I'm trying to pull some specific data from a wiki site; pcgamingwiki.
I would like to pull the save game data path from the site but I'm not understanding how to make the request properly. I also wanna state I'm not very knowledgeable about Visual Basic or even using C#, I did some VB back 5+ years ago and I remember bits a pieces.
What I want my app to do is using the steam game ID to search PCGamingWiki for the relevant game page ID, and then parse the save game location path of that game on that page.
I am using WikiClientLibrary with the Cargo extension support too.
This is the Visual Basic code that I have:
Async Sub main2()
Dim client As New WikiClientLibrary.Client.WikiClient()
Dim site As New WikiClientLibrary.Sites.WikiSite(client, "https://pcgamingwiki.com/w/api.php?")
Await site.Initialization
Dim page = New WikiClientLibrary.Pages.WikiPage(site, 3098)
Await page.RefreshAsync(WikiClientLibrary.Pages.PageQueryOptions.FetchContent)
RichTextBox1.AppendText(site.SiteInfo.SiteName)
RichTextBox1.AppendText(page.Content.Substring(0, 10000))
End Sub
And this Cargo query that gets the page ID from the Steam app ID
https://www.pcgamingwiki.com/w/api.php?action=cargoquery&tables=Infobox_game&fields=Infobox_game._pageID%3DPageID%2CInfobox_game.Steam_AppID&where=Infobox_game.Steam_AppID%20HOLDS%20"21000"&format=jsonfm
This is getting me the page information but I know there is a better way of getting the info.
Doing a wiki query for the sections gives me
{
"toclevel": 2,
"level": "3",
"line": "Save game data location",
"number": "3.2",
"index": "6",
"fromtitle": "Lego_Batman:_The_Videogame",
"byteoffset": 5842,
"anchor": "Save_game_data_location"
}
But the issue is that from what I could find is that I can only use the fromtitle and the index to get this information but on a different game page the fromtitle is different as it is the game name and the index changes as the content can be placed different on the page depending on the game.
I was hoping that I could use "number" as it seems they all are "3.2" or "anchor" as they all have "save_game_data_location" but I can't see how I could search by these identifiers. PCGamingWiki uses the Cargo extension but I'm not sure how I could make the right queries in visual basic to get the information I need or if there is another way of getting this content.
This is what the content on the page looks like
I'm just not sure how I convert the normal API queries cleanly and that Cargo query into Visual Basic code so any advice would be appreciated.

Where can you find or how can you create a chrome extension key and place it in your manifest.json file?

Looking to implement Oauth2 in my Chrome extension
I have been researching how to implement oauth2 on a chrome extension. I have been stuck for quite some time. I eventually got information to use chrome.identity in my background.ts file.
Here is my manifest.json
...
"permissions": [
"identity"
],
"oauth2": {
"client_id": "855289137547-bd37ghe68neqevqs47esitvc99rb5f8d.apps.googleusercontent.com",
"scopes":["https://www.googleapis.com/auth/userinfo.email"]
},
"background": {
"scripts": [
"background.js",
"runtime.js"
]
},
...
Call the chrome.identity API
There is a method on the API that is called getAuthToken which I am trying to call. When I try to call this method I get the following:
// background.ts
chrome.identity.getAuthToken({ interactive: true }, (token) => {
// store token here
});
Error
Unchecked runtime.lastError: OAuth2 request failed: Service responded with error: 'bad client id: 855289137522-bd37ggg68neqevqs47esitvc99rb5f8d.apps.googleusercontent.com'.
I checked multiple times and I can confirm that that the id is the same as I my console developer credentials.
Maybe it needs a key in the manifest
I was assuming that I have to have a key in my manifest.json. So, I followed the documentation at the following link where it says to follow the steps:
At the Developer Dashboard, click Add new item.
Click Choose file and select the .zip extension directory and upload it.
Without filling in additional fields, select Save Draft and return to dashboard.
Find the extension under Your Listings and click on more info. From the popup, copy the public key and add it to the manifest inside the unzipped directory under the "key" field.
However, I looked everywhere but could not find the "more info" link or any other info leading me to a key.
Key is available in the new UI --> Package on left side menu --> Public Key
At of time of my post (August 2020), if you go to the Developer Dashboard, you will always be directed to the new UI, which doesn't contain the More Information section, which means you can't find the public key.
AFAIK there is no other way to get the public key. You can't substitute your application ID because it is a hashed version of the public key,
Look for the Welcome popup on the bottom left corner of the screen and click on opt out link in tiny font to revert to the legacy interface.

CAS Multifactor Authentication Provider Selection

I am working with cas-overlay-template project in version 6.1.4. I have implemented two mfa providers on my CAS, Google Authenticator and CAS Simple. Both are working, I have tested them separately and I have got the results I've expected.
Until now, I have been activating the mfa modifying the cas.properties file adding this properties: cas.authn.mfa.globalProviderId=mfa-gauth when I wanted to use Google, or cas.authn.mfa.globalProviderId=mfa-simple when I used the CAS itself.
Well, in CAS documentation is mentioned that is possible to enable a provider selection menu, if resolved more than one just by adding this propertie: cas.authn.mfa.provider-selection-enabled=true. So, my configuration is the following:
cas.authn.mfa.provider-selection-enabled=true
cas.authn.mfa.globalProviderId=mfa-gauth
cas.authn.mfa.globalProviderId=mfa-simple
But when I try to login with any user (I'm using the default one casuser:Mellon), CAS don't show me a menu in which I can select the following mfa provider, It directly goes to mfa-simple provider.
What am I doing wrong?
Well, in CAS documentation is mentioned that is possible to enable a provider selection menu, if resolved more than one just by adding this properties:
So far so good.
So, my configuration is the following:
That's the problem. You are not resolving/triggering more than just one provider. You start with mfa-gauth and then override it with mfa-simple. In CAS 6.1.x, the globalProviderId only accepts a single identifier. It's not a list or a container of any kind to accept more than one value. This has been addressed in the next coming release.
At the moment, to resolve more than one provider you will need to assign the MFA providers to a registered service definition. Like so:
{
"#class": "org.apereo.cas.services.RegexRegisteredService",
"serviceId": "^(https|imaps)://.*",
"name": "Example",
"id": 1,
"description": "This service definition defines a service.",
"evaluationOrder": 1,
"multifactorPolicy" : {
"#class" : "org.apereo.cas.services.DefaultRegisteredServiceMultifactorPolicy",
"multifactorAuthenticationProviders" : [ "java.util.LinkedHashSet", [ "mfa-duo", "mfa-gauth" ] ]
}
}
This means, provider selection can be enabled on a per-application basis. Alternatively, you can write a small groovy script to return more than one provider back to CAS, allowing the selection menu to display the menu items.
Read this post for full details.

Is it possible to create multiple Chrome Hosted Apps for the same domain?

Our product has both a free component, and a full featured, subscription based web application. I've created a Chrome Hosted App - essentially an installable bookmark - for each both of those parts of our product.
The interesting parts of the app manifests are as follow:
"manifest_version": 2,
"app": {
"launch": {
"container": "tab",
"web_url": "https://paydirtapp.com/dashboard"
}
}
"manifest_version": 2,
"app": {
"launch": {
"container": "tab",
"web_url": "https://paydirtapp.com/free_invoice_creator"
}
}
I can install the free invoice creator app, and the full featured app, but not both at the same time.
Attempting to do so (in Chrome 26.0.1410.10 (Official Build 183151) dev) causes the following error message:
"An error has occurred. Could not add the application because it conflicts with "Free Invoice Maker".
The only reference I can find to this issue is in https://developers.google.com/chrome/apps/docs/developers_guide#manifest, where they state the following:
Important: If you provide multiple apps, avoid overlapping URLs. If a user tries to install an app whose "web_url" or "urls" values overlap with those of an already installed app, the second installation will fail due to URL conflict errors. For example, an app that specifies a "urls" value of "http://mail.example.com/" would conflict with an app that specifies "http://mail.example.com/mail/".
Previously, my web_url value was just set to https://paydirtapp.com/, which caused the same error. I expected that updating it so that it wasn't a substring of the other app would solve the problem, but it hasn't.
Does anyone know if it's possible to have multiple Chrome Hosted Apps where the web_url is for the same domain?
Answer from Moshe Matz (copy from comment):
Using separate subdomains for each app should work.
For example, use https://dashboard.paydirtapp.com and https://free_invoice_creator.paydirtapp.com. You will likely need a new SSL certificate that contains both of those names.
Separate subdomains should work. We don't currently have a solution for the same domain case.