I had to add groups of users as administrators to the Alfresco configuration. As this is a common requested feature, I will explain how I did it. This will also be a good example of how to tweak Alfresco internal classes by overriding its Spring beans. Before reading further, you should have read the howto on Alfresco modules creation.

In an org.alfresco.sample package in the source/java folder of the module, add the following class. This class will subclass the default Alfresco AuthorityService implementation to change only the setAdminUsers() method defining the administrators from the Spring configuration.

public class MyAuthorityService extends AuthorityServiceImpl {
    private TransactionService transactionService;

    @Override
    public void setAdminUsers(Set pConfig) {
        UserTransaction txn = transactionService.getUserTransaction();
        try {
            txn.begin();

            HashSet users = new HashSet();

            Iterator iter = pConfig.iterator();

            while (iter.hasNext()) {
                String authority = iter.next();
                AuthorityType type = AuthorityType.getAuthorityType(authority);

                if (type.equals(AuthorityType.GROUP) && authorityExists(authority)) {
                    // Get all the group's users
                    Set groupLogins = getContainedAuthorities(AuthorityType.USER, authority, false);
                    users.addAll(groupLogins);
                } else {
                    users.add(authority);
                }
            }

            super.setAdminUsers(users);
            txn.commit();
        } catch (Exception e) {
            try { txn.rollback(); } catch (Exception e1) { }
        }
    }

    public void setTransactionService(TransactionService pTransactionService) {
        this.transactionService = pTransactionService;
    }
}

Now that the implementation is changed, we need to tell Alfresco to use it instead of the default one. For this, add the following bean definition to the module-context.xml file. This Spring configuration is a copy of the one in the authority-service-context.xml file with some changes to use our own implementation. As our implementation needs the transaction service, it has been added as a property to the bean configuration.

<bean id="authorityService" class="org.alfresco.sample.MyAuthorityService">
    <property name="authenticationComponent">
        <ref bean="authenticationComponent" />
    </property>
    <property name="personService">
        <ref bean="personService" />
    </property>
    <property name="nodeService">
        <ref bean="nodeService" />
    </property>
    <property name="authorityDAO">
        <ref bean="authorityDAO" />
    </property>
    <property name="permissionServiceSPI">
        <ref bean="permissionServiceImpl" />
    </property>
    <property name="transactionService">
        <ref bean="transactionService" />
    </property>
    <property name="adminUsers">
        <set>
            <value>admin</value>
            <value>GROUP_Administrators</value>
        </set>
    </property>
</bean>

It is now possible to set the full name of a groupe in the administrators' list. In the example case, all the users of the GROUP_Administrators group will be administrators of Alfresco.