Updating acl file using JS in hyperledger-composer - hyperledger

I am working on hyperledger playground. I have found that the access rules for participants can be specified manually on acl file in hyperledger composer. But is there a way that allows me to add rules to this file using JS?
Example:
There is an organization. It has some assets, and its number of employees is not fixed. As the admin adds new employees, their access rights on these assets is not known beforehand.
Is there a way such that as new employees are added, I can dynamically create rules for them, modifying the .acl file by script?

see the condition property in the reference doc https://hyperledger.github.io/composer/latest/reference/acl_language. As the condition property accepts code, you can invoke functions that exist within your business network .js files, however these functions are not allowed to invoke the composer runtime API. A summary of those functions not allowed can be found here
https://hyperledger.github.io/composer/latest/api/runtime-api
If you try to use them it will throw an error.

Related

Can a rollup plugin get access to the entire module dependency graph?

I've got a rollup plugin I maintain and part of what it does requires it knowing about every module in the project. I don't know of a good way to get this information though.
resolveId() won't get called if the file was already resolved by any plugin further up the chain
generateBundle() doesn't include any modules that were tree-shaken away
Is there another hook I could use to get access to the module + importer information?
Try using this.getModuleInfo(id). If you have the ids of the entry points, this will give you all imported ids and basically let you crawl the whole graph. Note that during the build phase, plugins can emit additional entry points so you might want to use the Information from generateBundle as a starting point.

Modifying Hyperledger Composer WebApp

I've completed the Hyperledger Composer Developer tutorial https://hyperledger.github.io/composer/tutorials/developer-guide.html and I've generated the BNA, deployed it to a local Hyperledger Fabric 1.0 instance, generated the REST API, and generated the skeleton webapp using yo.
However, I noticed that the resulting webapp only has a menu for adding assets, and none for adding participants and submitting transactions. I have two questions:
1) Why doesn't the webapp generate menus for adding participants and submitting transactions? (or does it, and how do I get it to do that?)
2) In an attempt to add the ability to add participants and submit transactions through the webapp, I've looked through the app directory for the relevant source code but became confused as I'm relatively new to web/angular dev.
Is there any reference documentation to show which source files need to be edited to add participants and transactions?
As far as I can tell, \src\app folder has the source files but I don't understand the roles that each of these files play:
app.component.html has the actual HTML menus, but what is this [routerLink] referring to?
I noticed for each asset that there is a subfolder with a CSS, HTML, and three .TS files. Are these needed for each participant as well?
Any direction or reference on how to modify the web app to accommodate adding participants and transactions would be much appreciated.
1) Why doesn't the webapp generate menus for adding participants and submitting transactions? (or does it, and how do I get it to do that?)
Because its a very simple skeleton NG2 app scoped to assets, which you as a developer can add to. You can easily add REST API calls (operations) from your Angular app to (for example) submit transactions. This is how you should interact with the runtime Fabric using Composer REST operations.
2) Is there any reference documentation to show which source files need to be edited to add participants and transactions?
This is a straightforward Angular tutorial https://angular.io/tutorial and here https://angular.io/guide/quickstart - and this tutorial will help explain Angular further.
The dataservice in the generated App is where the current 'asset' REST operation is called from and further REST operations can be added here -> /src/app/data.service.ts

How Do I Load Assemblies Only From Trusted Source using Ninject?

I have an ILog interface that has multiple implementations. One will be writing to a database, one on Windows Event Log, another on an xml file, some on text files for different vendors.
Implementations of this interface are dynamically loaded using Ninject. With the growing number and the recent news on hacks and malwares sleeping on some networks, I would like to know if there is a way to filter the assemblies to only the trusted ones?
We are trying to prevent someone from just creating their own implementation of our interfaces and dropping the dll into the bin folder then they get access to the flow of our information.
Please note that we load assemblies that follows the ILog interface.
It is rather useless to try preventing this. If piece of malware can already write to the application folder, all your attempts to 'filter out' illegal dlls will always fail. The attacker can for instance simply replace the .exe and will run in the context of the user and can do everything that your application can do.

Dynamic Creating Named DataCache programmatically

With
new DataCache("myCacheName");
I can successfully access existing named cached in my managed AzureCacheService.
Using a name which was not created in the management portal raises an DataCacheException telling me that the cache doesnt exist.
Now I want dynamically create a new named DataCaches.
I can't find anything about this in the msdn documentation. Also Neither the DataCache nor the DataCacheFactory api are offering methods for creating
Isn't this supported? Any hints are welcome
Currently , configuration of named cache related properties within a managed cache (which includes creation of named caches, changing it's properties etc) can only be done via Azure portal from within the 'configure' tab. Doing it programmatically is not supported.

Assigning package name after changing the folder structure

In My struts2 project, I recently changed the folder structure, The following image shows the new folder structure.
So as a consequence i need to change the package name in Struts.xml.
I am a newbie to struts 2.So please suggest me the package name that suits for the above
folder structure. I have tried out in the below format. But it did not work.
In the above snippet,i set the package name as seasar.action Because i am having all of my action classes in it.
Package names are arbitrary; you can name it whatever you want.
Packages should be named something meaningful in the context of the app. One reason for multiple packages is to allow package-level configuration, like interceptor stacks, default result types, etc.
For example, a package may be used to provide "secured" access: its default interceptor stack might include a "login required"-type interceptor. One package might encapsulate an app's REST API and set the default result type to "json". Packages are just one mechanism to aggregate functionality.
Ultimately, package naming is application-specific, invisible to the end-user, and provided as a mean for developers to logically group arbitrary functionality, purpose, or intent.

Resources