Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mentor Digital 19 posts 135 karma points
    Jan 24, 2012 @ 12:39
    Mentor Digital
    0

    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!

  • Rodion Novoselov 694 posts 859 karma points
    Jan 24, 2012 @ 14:46
    Rodion Novoselov
    0

    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.

     

  • Mentor Digital 19 posts 135 karma points
    Jan 24, 2012 @ 18:07
    Mentor Digital
    0

    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?

  • Rodion Novoselov 694 posts 859 karma points
    Jan 24, 2012 @ 19:07
    Rodion Novoselov
    0

    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.

  • Mentor Digital 19 posts 135 karma points
    Jan 25, 2012 @ 12:43
    Mentor Digital
    0

    Ah, thanks! Just as I thought.

    Apart from a FileSystemWatcher approach, is there any way I can capture a save event in umbraco?

  • Rodion Novoselov 694 posts 859 karma points
    Jan 25, 2012 @ 12:49
    Rodion Novoselov
    0

    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

  • Rodion Novoselov 694 posts 859 karma points
    Jan 25, 2012 @ 13:11
    Rodion Novoselov
    0

    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.

  • Richard 146 posts 168 karma points
    Jan 25, 2012 @ 18:04
    Richard
    0

    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

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jan 25, 2012 @ 18:19
    Jeroen Breuer
    0

    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

  • Mentor Digital 19 posts 135 karma points
    Jan 26, 2012 @ 16:30
    Mentor Digital
    0

    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:

    • \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();
          }

          //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!

Please Sign in or register to post replies

Write your reply to:

Draft