How to restrict to empty trashcan - alfresco

I would like to restrict emptying of trashcan by ordinary users. Permission to empty trashcan should have only users with admin role.
I have several ideas, but I'm not sure about their accuracy. For example to implement Java method used as evaluator before button displaying? Or any other sophisticated way, solution or implementation, how to secure this restriction?
Thanks :)

You should create share-extension. It is a sophisticated way to implement this.
Follow the below-given steps in share project to achieve this.
Add the following module at share-widgets.xml located at web-extension/site-data/extensions/
<extensions>
<modules>
<module>
<id>Customize Share header - remove 'Trashcan' button from user
menu</id>
<version>1.0</version> <auto-deploy>true</auto-deploy>
<customizations> <customization>
<targetPackageRoot>org.alfresco.share.header </targetPackageRoot>
<sourcePackageRoot>org.alfresco.components.profile
</sourcePackageRoot>
</customization>
</customizations>
</module>
</modules>
</extension>
Create the folder structure under the site-webscripts as per the : org/alfresco/components/profile
Copy the following file userprofiletoolbar.get.js from the installed Alfresco instance and place it at the org/alfresco/components/profile
Change the following line from the userprofiletoolbar.get.js
// Add Trashcan link
addLink("user-trashcan-link", "user-trashcan", "link.trashcan");
to
if(user.isAdmin){
addLink("user-trashcan-link", "user-trashcan", "link.trashcan");
}
Restart the server.

Related

Sitecore IconCache images not displaying, paths are incorrect

I'm trying to set up a Sitecore 8.1 instance that I've taken over from another agency. I have the site running but none of the image files from the IconCache are displaying in Sitecore:
I inspected the missing images and found that their paths are incorrect- they all begin with "/~/icon/" rather than "/temp/IconCache"
In the production instance, the icon paths are correctly set to /temp/IconCache.
There is a know issue about this missing icons.
See Sitecore.Support.100371.100542
https://github.com/sitecoresupport/Sitecore.Support.100371.100542/releases
Another thing you can try is run the Clean up databases from the Control Panel, core database, but likely you need the patch.
For further research:
The icons are stored on file system in .zip files below:
\sitecore\shell\Themes\Standard\
For example this url
/~/icon/Office/24x24/publishing_restrictions.png.aspx
go to the
\sitecore\shell\Themes\Standard\Office.zip
Check if the icons are on file system. And check if the url works, if the icon url not work find out why. which error? use the original Sitecore config files and web.config file. and check if it works.
You need to have this in config
<customHandlers>
<handler trigger="~/icon/" handler="sitecore_icon.ashx" />
And in the web.config
<handlers>
<add verb="*" path="sitecore_icon.ashx" type="Sitecore.Resources.IconRequestHandler, Sitecore.Kernel" name="Sitecore.IconRequestHandler" />
After the icon is used it is stored in the
\temp\IconCache
directory.

Is it possible to extend an Alfresco 5 web-script for the post method?

I'm trying to add some extra functionality to the site creation form of Alfresco 5 by creating a web script. I'm creating a jar file containing the module extension.
I have successfully modified the actual site creation for by adding a new site type (this was done for testing purposes only). I did this by adding the following to the extension-module.xml file:
<module>
<id>Create Site Extension</id>
<version>1.0</version>
<customizations>
<customization>
<targetPackageRoot>org.alfresco.modules</targetPackageRoot>
<sourcePackageRoot>create-site</sourcePackageRoot>
</customization>
</customizations>
</module>
/config/alfresco/web-scripts/create-site.get.js
model.sitePresets.push({
id: "site-test",
name: "TEST"
});
When added to tomcat/webapps/share/WEB-INF/lib and activated through the Alfresco module management page it works perfectly. I can see TEST in the list of site types.
I'm trying to do the exact same type of thing but with create-site.post.json.js. No matter what I do, I can't get my create-site.post.json.js web-script to fire. Is it possible to extend the .post.json.js file for create-site?
UPDATE
In case anyone wants to look at the raw source, here it is: Module Srouce
Everything in the module works correctly except for the create-site.post.json.js. I know for a fact that the deleteDashboard method inside the .post.json.js file works correctly and it's what I've been using to attempt to debug the script (in case the debugger was running it but not breaking into it for some reason. If it runs, it should delete the test site "good-site"'s dashboard so if it worked, the dashboard will be empty/nonexistent.
The issue is obvious. Because you are using extension module and overriding out of box webscript. Now if you change the type of webscript from get to post it will not override it. So, if you really want to replace out of box webscript with yours then you need to get to the point where this component is called and override that. You will also require to create full post webscript (all related files)

GWT + Eclipse - how to refresh static resources such as CSS

I am developing GWT application in Eclipse in Hosted mode.
When I change something in CSS I cant see it in browser. I am trying full reload in browser using CTRL+F5, restarting my App in Eclipse and no change.
Only thing which helps is rebuild my app using maven clean install, restart App in Eclipse and then i can see changes. This takes a lot of time.
Any idea what I am doing wrong? I think there must be better way.
regards,Lukas
The problem is that in dev mode the src webapp folder copied to target only at startup, and DevMode does not refresh it. As a workaround you can use copy-resources, that take care of applying changes on the fly.
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/gwt-webapp</outputDirectory>
<resources>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
I use an external CSS file for my app, and I immediately see all changes in my browser upon simple refresh (no emptying cache, server restart, etc.) in both Chrome and Firefox.
The problem may be related to the location of your file. My file is in the /war directory, and I edit it directly. Another possibility is how you reference your file in your host page. Make sure you have a relative path like "/myCss.css".
There are 3 ways to solve this problem. I don't use eclipse though (I code with IntelliJ and use hosted mode from my command line Gradle script), but hopefully they should all work anyway.
The first is to figure out where your hosted mode is serving the files from, ideally an exploded war directory. In there, you can find the CSS file, which will be an exact replica of your CSS file that you're trying to change. Make your modifications there, reload, modify, etc, and then when you're done don't forget to copy that file and paste it back into your source directory. I use VIM and switch back and forth. I'm sure you could write a script that copied the file back over when hosted mode ended, if you were a keener.
The second method (and a much better method), as user1570921 points out, is to embed the CSS in your UIBinder code. For example, you might have:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:style>
.outsidePanel {
background: #00F;
}
</ui:style>
<g:HTMLPanel styleName="{style.outsidePanel}">
Hello, World!
</g:HTMLPanel>
In the example above, you could edit the CSS inside the ui:style section, hit F5 and see the changes, then make more changes, etc. No need to copy files over.
Here's a good link for more info: https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinder#Hello_Stylish_World
The third way is to use Google Chrome's Dev Tools (CTRL-Shift-I) or F12 in Firefox. In there you can edit the CSS inline without modifying your file at all. Fiugure out all of the right values, add new ones, remove old ones, and then make those same changes to your CSS file. Then you don't have to keep redeploying to see changes.
I personally use a combination of #2 and #3.
Try to put a line <stylesheet src="sheet.css" /> or <stylesheet src="/sheet.css" /> into your project.gwt.xml file.
Regards,
Eddy
From your project/application web page, view page source. Normally an option when we right click the page.
Click the .css file link, which appear something like this:
<link type="text/css" rel="stylesheet" href="Foo.css"
in this case click on Foo.css
The contents of the .css file will be displayed but probably not include your changes. In that case refresh the .css text by pressing F5 or the browser refresh button.
If your .css changes now appear, go back to your GWT project web page and refresh once more.
Alternatively using a different browser could temporarily show your new changes but if it too fails to refresh the .css file, then the procedure above will be necessary.

How can we override the existing deployer customization in Tridion 2009?

While in process of customizing Deployer, I noticed that we have already customized PageDeploy and PageUndeploy modules, please see the below config sections taken from cd_deployer_conf.xml.
PageDeploy:
<Module Type="PageDeploy"
Class="com.tridion.extensions.deployer.ConditionalPageDeploy">
<Transformer Class="com.tridion.deployer.TCDLTransformer" />
</Module>
PageUndeploy:
<Module Type="PageUndeploy"
Class="com.tridion.extensions.deployer.ConditionalPageUndeploy"/>
I just have their .jar file no code as this was done by SDL Tridion when they implemented Tridion in our company, now I want to implement one new process when page is published or unpublished.
What changes do I need to do so that without touching existing customization, I can implment the new customization. Is it permitiable or supported in Tridion?
You might want to ask around in your department. Typically Tridion Professional Services will leave the code for any customization they make at the customer's site, specifically so that you can make changes to it afterwards.
Alternatively, you can create an additional Deploy/Undeploy module for your functionality. There can be multiple modules per type, so you can just add your own module to the list.

Custom filename in a rolling Log4Net logfile?

We have a ASP .Net application whereby we use Log4Net to log details within the app - nothing new there - and the rolling log filenames are in the usual format of:
rolling-log.txt
rolling-log.txt.1
rolling-log.txt.2 etc.
A each user of the application adds to the logfile, the logfile can be difficult to read for a specific user's case and so, we'd like to modify the config file somehow to record the user's log details individually, each writing to a specific file, e.g.
<applicationId>rolling-log.txt
<applicationId>rolling-log.txt.1
<applicationId>rolling-log.txt.2
etc.
where is each user's unique application Id, made up of a five digit number, e.g.
12345rolling-log.txt
Any ideas on the best way to implement this, assuming that it's possible?
Cheers
Brett
<file type="log4net.Util.PatternString">
<conversionPattern value="C:\Logs\log-%date{ yyyy.MM.dd.HH.mm.ss}-[%processid].log" />
</file>
from here
look for log4net Context Properties...
in your code :
log4net.GlobalContext.Properties["id"] = "12345";
then
log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo("configPath"));
in the log4net config file:
<file type="log4net.Util.PatternString"
value="%property{id}rolling-log.txt" />
I believe the Log4Net configuration file supports environment variables (e.g. USERNAME) as well as customizable patterns which should give you what you want.
Look at "PatternString for pattern based configuration" in the Log4Net V1.2.10 release notes.
I don't think that log file per user is possible but you can write custom layer between log4net and your application which prepends user id before writing to log.
You can write a custom layout by inherit from XmlLayoutBase.
Checkout the RollingPatternFileAppender, just like the rollingfileappender plus dynamic file name
http://mysite.verizon.net/vze14bhji

Resources