Copied to clipboard

Flag this post as spam?

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


  • Jonas 123 posts 206 karma points
    Dec 03, 2015 @ 14:06
    Jonas
    0

    Multisite and permissions.

    Hi,

    We are going to use the excellent UI-O-Matic as an admin on a multisite installation.

    How do we go about and restrict content so that only editors from a specific site can admin certain content.

  • Comment author was deleted

    Dec 03, 2015 @ 14:36

    Well the only option you have now is to restrict access to the UI-O-Matic section (so it's either access to all or none).

  • Comment author was deleted

    Dec 03, 2015 @ 14:38

    What would the permissions options be that you need, I can look into adding a simple workflow (so that on the attribute you can specify if a certain member group has access or not)

  • Comment author was deleted

    Dec 03, 2015 @ 14:41

    Usertypes that is not member groups, but if you sketch your scenario I'll see if it's doable

  • Jonas 123 posts 206 karma points
    Dec 03, 2015 @ 14:43
    Jonas
    0

    Just check that the backenduser loggedin has access to a certain siteroot/nodeid would do.

    We could add NodeId to the table.

  • Comment author was deleted

    Dec 03, 2015 @ 14:48

    So say you have table x and table y and user john and user jane, john would only need access to table x and jane to table y, something like that? So removing an entire tree based on the logged in user? Not sure I can make something generic, but could add an event model that would allow you to remove the node based on some rules (that you can specify)

  • Jonas 123 posts 206 karma points
    Dec 03, 2015 @ 14:53
    Jonas
    0

    Well, we want all users to have access to the tables.

    Say we have a small bookingsystem with one table only.

    In that table we only want John and Jane to see "their" content. And since they are "mapped" to SiteRoot XX they will only see content with SiteRootId XX.

    Does this make sense? :-)

    enter image description here

  • Comment author was deleted

    Dec 03, 2015 @ 14:56

    It does :) in this case you basically want to add an additional where statement to the sql query fetching the data

    Again will try to do this with an event model so it's possible to have hook into stuff like these

    Shouldn't be that hard, will get that done today/tomorrow

  • Comment author was deleted

    Dec 03, 2015 @ 15:27

    Ok just made a couple of changes that now add an event model, you should be able to attach to the following 2 events

    UIOMatic.Controllers.PetaPocoObjectController.BuildingQuery
    UIOMatic.Controllers.PetaPocoObjectController.BuildedQuery
    

    As you can see in the code here https://github.com/TimGeyssens/UIOMatic/blob/master/src/UIOMatic/Controllers/PetaPocoObjectController.cs

    They should allow you to manipulate the query before it's bein executed, thus adding your additional rules :)

    I'll give your scenario a go tomorrow

  • Comment author was deleted

    Dec 03, 2015 @ 16:05

    Ok so this is now an example

    public class EventHandlerscs: ApplicationEventHandler
    {
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            UIOMatic.Controllers.PetaPocoObjectController.BuildingQuery += PetaPocoObjectController_BuildingQuery;
        }
    
        void PetaPocoObjectController_BuildingQuery(object sender, UIOMatic.QueryEventArgs e)
        {
            if (e.TableName == "ccpEvent")
                e.Query.Where("AREAID = @0", 2);
        }
    }
    

    You get the gist here? You'll need to filter on your table name first and then set the where on your SiteRootId, fetching that value in some way from your user...

  • Jonas 123 posts 206 karma points
    Dec 04, 2015 @ 09:20
    Jonas
    0

    Worked like a charm, thanks.

    Now I just have to find out a way to get the "Start Node in Content" ID from Umbraco.

  • Zac 223 posts 575 karma points
    Dec 30, 2015 @ 17:06
    Zac
    0

    Jonas, if you found one, would you mind sharing your solution for grabbing the user's start node in this context?

  • Jonas 123 posts 206 karma points
    Jan 11, 2016 @ 10:24
    Jonas
    1

    e.Query.Where("SiteRootId = @0", UmbracoContext.Current.Security.CurrentUser.StartContentId);

  • Comment author was deleted

    Dec 04, 2015 @ 09:26

    Great :) thanks for confirming!

Please Sign in or register to post replies

Write your reply to:

Draft