Forum OpenACS Q&A: Packages mounted on subsites inherit permissions from Main Site

My main site has such permissions:

Inherited Permissions
    * Site administrator, admin

Direct Permissions
    * none

When I add a subsite, it has such permissions (default behaviour):

Inherited Permissions
    * The Public, read
    * Site administrator, admin

Direct Permissions
    * subsite Administrators, admin
    * subsite Members, read
    * subsite Members, create
    * subsite Members, write

And then, when I mount any application on this subsite, say ETP, I get:

Inherited Permissions
    * The Public, read
    * Site administrator, admin

Direct Permissions
    * none

I expected it to inherit the permissions from the subsite, not the main site. Am I missing something? Isn't this the intended behaviour?

I found a similar discussion but it's from an old ACS version (4.5)

https://openacs.org/forums/message-view?message_id=51478

I think the problem is in this piece of code at /packages/acs-subsite/www/admin/site-map/package-new.tcl

    # Set the context_id to the object_id of the parent node
    # If the parent node didn't have anything mounted, use the current package_id as context_id
    set context_id [ad_conn package_id]
    array set node [site_node::get -node_id $node_id]
    if { ![empty_string_p $node(parent_id)] } {
        array set parent_node [site_node::get -node_id $node(parent_id)]

        if { ![empty_string_p $parent_node(object_id)] } {
            set context_id $parent_node(object_id)

I don't see why you would want it like that, the first line should be enough. Isn't it?

I don't know why nobody has responded to this, and I don't know the code personally, but the problem might be that the Main Site could be a special case, that requires public access?
I think I've found the problem: there are two ways of mounting an application in a site or subsite and one of them is broken.

The fist way, the one that works fine, is going to the site-map, click on "add folder" to create de node, and then click on "new application" to mount the application in this new node. This way, the passed node_id is the right one, and the context_id (and therefore inherited permissions) are set fine.

The other way is going to the site-map, and using the "mount package" form, which creates the node and mounts the package in a single step. This is the one that does not set the context_id right, because the passed node_id corresponds to the parent node, the place under which we are trying to mount the new application.

Do I make myself clear?

I think this can be considered a bug, so if someone can confirm it, I'll post a bug in the bug tracker.

This certainly sounds like a bug, and also a good find.