As for the first question I suspect that it's not possible - if you even find the way to somehow hide certain tree nodes then nevertheless nothing can prevent a user to open for example a stylesheet by directly typing an URL like "/umbraco/settings/stylesheet/editStylesheet.aspx?id=NNNN" and like that. Most editor pages themselves control access only on the section level (Content/Media/Settings/etc.). Content, however is a special case - finer permissions can be set on it.
Hi. This stuff with CSS is quite entangled in Umbraco because in fact any stylesheet is stored both on the file system and in the database. The StyleSheet class is targeted mostly to work with the part stored in the database. Its events have nothing to do with saving a CSS file on the filesystem - it happens nevertheless - you can make sure of it from the source code or some experiments.
BTW, there's also a bug that I've reported just recently - all of a sudden even disabling coressponding sections for a user doesn't prevent possible writing to css/js/etc files: http://umbraco.codeplex.com/workitem/30687
I have a clue that actually it would be possible to modify the "~/umbraco/webservices/codeEditorSave.asmx" file to point it to an own class that in turn will inherit the original "umbraco.presentation.webservices.codeEditorSave" class but intercept calls to it. That's the very webservice/class through which saving files from the code editor passes.
Does any one know if it is possible to extend / modify access to certain things under the settings area?
If you add a new Section, can you control access to a new section. So create a cut down version of Settings and give the third party development company to access scripts in this new section, and not access to Settings.
Thankyou for all your suggestions. I basically wanted to capture the Save event so I can make a backup of all scripts, stylesheets and templates inside umbraco every time someone saved. This way we could role back to a previous version if any interface developers make a mistake. Just like an SVN.
Heres my solution:
I actually looked into what the code editors were doing so I edited the following files:
\umbraco\settings\stylesheet\editstylesheet.aspx
\umbraco\settings\scripts\editscript.aspx
\umbraco\settings\edittemplate.aspx
An example of what I edited on them is:
function doSubmit() { var codeVal = jQuery('#').val(); //if CodeMirror is not defined, then the code editor is disabled. if (typeof(CodeMirror) != "undefined") { codeVal = codeEditor.getCode(); }
Controlling what is displayed in the Settings umbraco tree
Hey guys,
Does any one know if it is possible to extend / modify access to certain things under the settings area?
For example, I want a third party development company to access scripts but not document types.
And, is there a way to capture the save event of scripts so I can perform logging and auditing?
Is there any way I can do any of this?
Thankyou! I will rate!
As for the first question I suspect that it's not possible - if you even find the way to somehow hide certain tree nodes then nevertheless nothing can prevent a user to open for example a stylesheet by directly typing an URL like "/umbraco/settings/stylesheet/editStylesheet.aspx?id=NNNN" and like that. Most editor pages themselves control access only on the section level (Content/Media/Settings/etc.). Content, however is a special case - finer permissions can be set on it.
I found I could inherit ApplicationBase and add
StyleSheet.BeforeSave += new StyleSheet.SaveEventHandler(BeforeSave);
But for some reason this is only called on css documents that were FTPd and not ones that were created inside umbraco.
Is this a bug?
Hi. This stuff with CSS is quite entangled in Umbraco because in fact any stylesheet is stored both on the file system and in the database. The StyleSheet class is targeted mostly to work with the part stored in the database. Its events have nothing to do with saving a CSS file on the filesystem - it happens nevertheless - you can make sure of it from the source code or some experiments.
Ah, thanks! Just as I thought.
Apart from a FileSystemWatcher approach, is there any way I can capture a save event in umbraco?
BTW, there's also a bug that I've reported just recently - all of a sudden even disabling coressponding sections for a user doesn't prevent possible writing to css/js/etc files: http://umbraco.codeplex.com/workitem/30687
I have a clue that actually it would be possible to modify the "~/umbraco/webservices/codeEditorSave.asmx" file to point it to an own class that in turn will inherit the original "umbraco.presentation.webservices.codeEditorSave" class but intercept calls to it. That's the very webservice/class through which saving files from the code editor passes.
Just a thought, for:
Does any one know if it is possible to extend / modify access to certain things under the settings area?
If you add a new Section, can you control access to a new section. So create a cut down version of Settings and give the third party development company to access scripts in this new section, and not access to Settings.
Richard
Hi Richard,
You can have parts of the settings section in a different section. Have a look at this package: http://our.umbraco.org/projects/backoffice-extensions/digibiz-dictionary-section.
Jeroen
Hi all,
Thankyou for all your suggestions. I basically wanted to capture the Save event so I can make a backup of all scripts, stylesheets and templates inside umbraco every time someone saved. This way we could role back to a previous version if any interface developers make a mistake. Just like an SVN.
Heres my solution:
I actually looked into what the code editors were doing so I edited the following files:
An example of what I edited on them is:
function doSubmit() {
var codeVal = jQuery('#').val();
//if CodeMirror is not defined, then the code editor is disabled.
if (typeof(CodeMirror) != "undefined") {
codeVal = codeEditor.getCode();
}
//MY CODE
jQuery.ajax({
url: "/stylesheetSVN.ashx?name=" + jQuery('#').val(),
async: false
});
//END OF MY CODE
umbraco.presentation.webservices.codeEditorSave.SaveCss(jQuery('#').val(), '', codeVal, '', submitSucces, submitFailure);
}
So I created a generic handler (.ashx) that would take the name of the stylesheet, make a backup and register in a log what user made the change.
Hope that helps anyone in the future!
is working on a reply...