cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic creation of custom site group

zxdev777
Confirmed Champ
Confirmed Champ

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 2

ruudg
Confirmed Champ
Confirmed Champ

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
Confirmed Champ
Confirmed Champ

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}