How to save the registry after removing asset from it? - hyperledger-composer

How to save the registry after removing asset from it?
After removing the asset from registry, Do I need to save it with any api method ?
Use Case :
1. Remove the asset from the asset listing registry.
2. Save the asset listing asset registry.

Yes! You need to update the asset by calling the Runtime API
First, you need to remove the asset from the registry and then you need to update back with the new structure.
For an easy way, you can use the DELETE request to remove your asset data via REST API calls.

Related

Change Laravel Web Tinker Public Files Directory - Prevent 403 Error on Saving

I love this little library - so helpful.
However, it places some of its css and js files in a vendor folder inside the public directory of Laravel. I've got a Vendor class and paths in several apps and so, when saving a new Vendor, it redirects 403 Forbidden due to the conflicted vendor folder in the public directory.
I can't go back and refactor just for this to work, much as I like it.
It comes with a publishable config file, but I don't see an option to change the path to these files to a location outside the vendor folder. I don't want to make changes to the Spatie files, as this would just be overwritten upon next update.
Am I missing something easy here? Any way to get around this?
There isn't currently a config setting that allows you to control this.
The line causing you grief is here - https://github.com/spatie/laravel-web-tinker/blob/master/src/WebTinkerServiceProvider.php#L29. It publishes the compiled assets, as you say, into the public/vendor folder.
If you do not want to refactor your existing work, you can:
PR/fork a change to add this as a config setting
Manually change it on your end (although this could easily break if you republsihed the assets ever

Laravel - where to store files which I don't want to share with users

For example, I want to merge two .png files in one .png file, but I don't want to share those parts with user. Currently I am storing files in storage folder, but the problem is that storage folder is with .gitignore file as default. Of course I could allow to push it to git, but I suppose it's not a good idea, because there could be thousands of another files uploaded by the user. Now if I want to continue work from another computer I should move all my parts manually.
So what you could advice to me?
You can store it anywhere you want in your application.
For example, you can make a folder in your projects root called /uploads and then use one of laravel helper functions to specify where to save the file:
Example:
$save_path = base_path('uploads');
You can use the Laravel File Class to make sure the path exists with:
File::makeDirectory($save_path, $mode = 0755, true, true);
You will need to add use File; in the top of the file with all the class includes.
Later, to access said files you can make a View Composer which you can add logic to in order to limit who can view the file.
If you want to protect your files so that nobody can access without permission store all file into storage folder. Don't put your file in public folder.

How to source images from my storage to NetSuite without uploading them to the file cabinet?

In order to place images in the web store, they have to be uploaded to the file cabinet and then the file name needs to be associated with the item.
What I am looking to do, is to source the images from my current internal storage to NetSuite and still be able to view the images on the website. I am trying to find a way to do this because I don't want to have to upload them all individually or with a mass upload.
You will need to create a custom item field of type "text" and associate the field to the item record.
You can then place the full path to your image in the field you just created and reference the custom field in your templates.
This will allow you to use urls from your own host, but dynamically be able to use them within the NetSuite web store.

how to remove old image when user upload a new one - symfony2

I'm doing the administration of an entity that have a image field.
I've followed the Lifecycle Callbacks, but I have a problem: when I edit an existing object, and I change the image, the old image remains on the server.
How can I delete it?
Thanks!
The easiest way is to unlink the file.
Before uploading take the current filename and delete them. You could do that in the set funktion for the name or the uplload function. You should do that before you overwrite the global variable for the name.

why my IgnoreRoute does not work?

I want to prevent users access for my "~/Content/..." folder I wrote it as follow in "Global.asax.cs" and put this line of code at the top of every other routes
routes.IgnoreRoute("Content/{*pathInfo}");
but it does not work. in fact user can see every files in content folder by type the URL in browser.
am I missing something?
How did you figure out that it does not work? Give example.
You may have put it last in the Routing table. So try to move it up so that it gets added to the routing table first. The route collection is an ordered list of routes.
Also try this : Routes.IgnoreRoute("Content/");, but your version of ignore is also correct and it should work.
Lastly, I do not know what you mean when you say the user can see all the contents of the Content folder : Isn't that the point? User must be able to download files from the folder, and we usually just need MVC to ignore the requests from coming into the framework, and so that IIS can directly serve those files.
or did you mean Directory browsing is enabled, and you want to disable that : In that case go to IIS manager, and select your website and look for the Directory browsing option and disable it as shown here.
Your problem cannot be solved by routing constraints. There are 3 significant steps in processing request:
IIS got request.
IIS watch at filesystem and search for direct correspondence to file
If IIS didn't found any file - it gives request to ASP.NET MVC for processing.
So, you need to configure folder security to forbidden direct access to files, but allow access to application, as here.
But I don't recommend to secure folder, that should be shared. I don't believe that your site shouldn't have images to display :) If you have some secured content, you need to create another folder.

Resources