Automatic creation of custom site group

cancel
Showing results for 
Search instead for 
Did you mean: 
zxdev777
Active Member II

Automatic creation of custom site group

Hi all,

Is it possible to define additional custom site group ? So always when new site is created additional group {site identifier}_SpecialGroup will be also created.

Let's say my requirement is to have one folder in site, where just users with this special role should have access.

I don't want to create it manually always when new site is created.

Thanks

2 Replies
ruudg
Active Member II

Re: Automatic creation of custom site group

You should create a class like this:


public class SiteCreateEvent implements NodeServicePolicies.OnCreateNodePolicy {

    private PolicyComponent policyComponent;

    public void init() {

        this.policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME, SiteModel.TYPE_SITE, new JavaBehaviour(
            this, "onCreateNode", NotificationFrequency.TRANSACTION_COMMIT));

    }


    @Override
    public void onCreateNode(ChildAssociationRef childAssocRef) {

         // Your code to create the group


    }

    public void setPolicyComponent(PolicyComponent policyComponent) {

        this.policyComponent = policyComponent;
    }


}

zxdev777
Active Member II

Re: Automatic creation of custom site group

Thanks I will try

So my custom group will look like: site_{site id}_MyCustomRole and I will add it to group site_{site id}