Index: openacs-4/packages/acs-bootstrap-installer/bootstrap.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/bootstrap.tcl,v diff -u -r1.19 -r1.20 --- openacs-4/packages/acs-bootstrap-installer/bootstrap.tcl 22 Jan 2003 15:29:58 -0000 1.19 +++ openacs-4/packages/acs-bootstrap-installer/bootstrap.tcl 30 Jan 2003 14:10:42 -0000 1.20 @@ -139,6 +139,11 @@ bootstrap_fatal_error "The request processor routines have not been loaded." } + # Instantiate and mount core packages if not already done + if { ![ad_acs_admin_node] } { + apm_mount_core_packages + } + ns_log "Notice" "Done loading OpenACS." }] Index: openacs-4/packages/acs-bootstrap-installer/installer/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer/index.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-bootstrap-installer/installer/index.tcl 10 Sep 2002 22:22:06 -0000 1.8 +++ openacs-4/packages/acs-bootstrap-installer/installer/index.tcl 30 Jan 2003 14:10:55 -0000 1.9 @@ -39,7 +39,7 @@ install_return 200 "Error" " The installation program has encounted an error. Please drop your OpenACS tablespace and the OpenACS username, recreate them, and try again. You can log this as a bug -using the SDM. +using the OpenACS Bug Tracker. " return } Index: openacs-4/packages/acs-bootstrap-installer/installer/packages-install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer/Attic/packages-install.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-bootstrap-installer/installer/packages-install.tcl 29 Aug 2001 21:22:48 -0000 1.3 +++ openacs-4/packages/acs-bootstrap-installer/installer/packages-install.tcl 30 Jan 2003 14:10:55 -0000 1.4 @@ -31,14 +31,13 @@ # Complete the initial install. -if { ![ad_acs_admin_node] } { - ns_write "

  • Completing Install sequence.

    +ns_write "

  • Completing Install sequence by instantiating acs-kernel and mounting the main site.

    "
    -    cd [file join [acs_root_dir] packages acs-kernel sql [db_type]]
    -    db_source_sql_file -callback apm_ns_write_callback acs-install.sql
    -    ns_write "
    " -} +cd [file join [acs_root_dir] packages acs-kernel sql [db_type]] +db_source_sql_file -callback apm_ns_write_callback acs-install.sql +ns_write "" + ns_write "All Packages Installed." ns_write "

    Generating secret tokens..." Index: openacs-4/packages/acs-kernel/sql/oracle/acs-install.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/acs-install.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-kernel/sql/oracle/acs-install.sql 11 Jan 2003 11:02:56 -0000 1.8 +++ openacs-4/packages/acs-kernel/sql/oracle/acs-install.sql 30 Jan 2003 14:10:30 -0000 1.9 @@ -49,99 +49,6 @@ privilege => 'read' ); - lang_id := apm_service.new ( - instance_name => 'OpenACS Localization Utils', - package_key => 'acs-lang', - context_id => main_site_id - ); - apm_package.enable(lang_id); - - -- All users, whether registered or not, set their locale preference at /acs-lang - acs_permission.grant_permission ( - object_id => lang_id, - grantee_id => acs.magic_object_id ('the_public'), - privilege => 'read' - ); - - node_id := site_node.new ( - parent_id => site_node.node_id('/'), - name => 'acs-lang', - directory_p => 't', - pattern_p => 't', - object_id => lang_id - ); - - admin_id := apm_service.new ( - instance_name => 'ACS Administration', - package_key => 'acs-admin' - ); - apm_package.enable(admin_id); - - node_id := site_node.new ( - parent_id => site_node.node_id('/'), - name => 'acs-admin', - directory_p => 't', - pattern_p => 't', - object_id => admin_id - ); - - - cr_id := apm_service.new ( - instance_name => 'ACS Content Repository', - package_key => 'acs-content-repository' - ); - - node_id := site_node.new ( - parent_id => site_node.node_id('/'), - name => 'acs-content-repository', - directory_p => 't', - pattern_p => 't', - object_id => cr_id - ); - - docs_id := apm_service.new ( - instance_name => 'ACS Core Documents', - package_key => 'acs-core-docs', - context_id => main_site_id - ); - - docs_id := site_node.new ( - parent_id => site_node.node_id('/'), - name => 'doc', - directory_p => 't', - pattern_p => 't', - object_id => docs_id - ); - - api_doc_id := apm_service.new ( - instance_name => 'ACS API Browser', - package_key => 'acs-api-browser', - context_id => main_site_id - ); - - apm_package.enable(api_doc_id); - - -- Set default permissions for ACS API Browser so - -- that only users logged in can view it - - update acs_objects - set security_inherit_p = 'f' - where object_id = api_doc_id; - - acs_permission.grant_permission ( - object_id => api_doc_id, - grantee_id => acs.magic_object_id ('registered_users'), - privilege => 'read' - ); - - api_doc_id := site_node.new ( - parent_id => site_node.node_id('/'), - name => 'api-doc', - directory_p => 't', - pattern_p => 't', - object_id => api_doc_id - ); - select user into schema_user from dual; dbms_job.submit ( Index: openacs-4/packages/acs-kernel/sql/postgresql/acs-install.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/acs-install.sql,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-kernel/sql/postgresql/acs-install.sql 11 Jan 2003 11:03:10 -0000 1.13 +++ openacs-4/packages/acs-kernel/sql/postgresql/acs-install.sql 30 Jan 2003 14:10:08 -0000 1.14 @@ -68,200 +68,12 @@ ''read'' ); - lang_id := apm_service__new ( - null, - ''OpenACS Localization Utils'', - ''acs-lang'', - ''apm_service'', - now(), - null, - null, - main_site_id - ); - - PERFORM apm_package__enable (lang_id); - - -- All users, whether registered or not, set their locale preference at /acs-lang - PERFORM acs_permission__grant_permission ( - lang_id, - acs__magic_object_id (''the_public''), - ''read'' - ); - - node_id := site_node__new ( - null, - site_node__node_id(''/'', null), - ''acs-lang'', - lang_id, - ''t'', - ''t'', - null, - null - ); - - admin_id := apm_service__new ( - null, - ''ACS Administration'', - ''acs-admin'', - ''apm_service'', - now(), - null, - null, - null - ); - - PERFORM apm_package__enable (admin_id); - - node_id := site_node__new ( - null, - site_node__node_id(''/'', null), - ''acs-admin'', - admin_id, - ''t'', - ''t'', - null, - null - ); - - - acs_sc_id := apm_service__new ( - null, - ''ACS Service Contract'', - ''acs-service-contract'', - ''apm_service'', - now(), - null, - null, - null - ); - - PERFORM apm_package__enable (acs_sc_id); - - node_id := site_node__new ( - null, - site_node__node_id(''/'', null), - ''acs-service-contract'', - acs_sc_id, - ''t'', - ''t'', - null, - null - ); - - - cr_id := apm_service__new ( - null, - ''ACS Content Repository'', - ''acs-content-repository'', - ''apm_service'', - now(), - null, - null, - null - ); - - PERFORM apm_package__enable (cr_id); - - node_id := site_node__new ( - null, - site_node__node_id(''/'', null), - ''acs-content-repository'', - cr_id, - ''t'', - ''t'', - null, - null - ); - - docs_id := apm_service__new ( - null, - ''ACS Core Documents'', - ''acs-core-docs'', - ''apm_service'', - now(), - null, - null, - main_site_id - ); - - node_id := site_node__new ( - null, - site_node__node_id(''/'',null), - ''doc'', - docs_id, - ''t'', - ''t'', - null, - null - ); - - api_doc_id := apm_service__new ( - null, - ''ACS API Browser'', - ''acs-api-browser'', - ''apm_service'', - now(), - null, - null, - main_site_id - ); - - PERFORM apm_package__enable (api_doc_id); - - insert into inline_data (id,name) values (api_doc_id, ''api_doc_id''); - return null; end;' language 'plpgsql'; - - -- Set default permissions for ACS API Browser so - -- that only users logged in can view it -create function inline_1 () returns integer as ' -declare - api_doc_id integer; -begin - - select id into api_doc_id - from inline_data where name = ''api_doc_id''; - - PERFORM acs_permission__grant_permission ( - api_doc_id, - acs__magic_object_id (''registered_users''), - ''read'' - ); - - api_doc_id := site_node__new ( - null, - site_node__node_id(''/'',null), - ''api-doc'', - api_doc_id, - ''t'', - ''t'', - null, - null - ); - - return null; - -end;' language 'plpgsql'; - -create table inline_data ( - id integer, - name varchar -); - select inline_0 (); -select id from inline_data where name = 'api_doc_id'; -update acs_objects - set security_inherit_p = 'f' - where object_id = (select id from inline_data where name = 'api_doc_id'); - -select inline_1 (); - drop function inline_0 (); -drop function inline_1 (); -drop table inline_data; -- show errors Index: openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl,v diff -u -r1.29 -r1.30 --- openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 30 Jan 2003 10:27:27 -0000 1.29 +++ openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 30 Jan 2003 14:08:47 -0000 1.30 @@ -1292,6 +1292,65 @@ return $query_file_list } +ad_proc -private apm_mount_core_packages {} { +

    + On first startup (bootstrap) of OpenACS - instantiate, mount, + and grant appropriate permissions to packages part of all + OpenACS installations. +

    + +

    + The reason this proc is not invoked from the installer is that + we don't currently have the full Tcl environment set up there (for + example ad_conn). + The reason acs-kernel and the main site are not set up in this + proc is that they are needed during the installation. They are + set up in acs-kernel/sql/postgresql/acs-install.sql. +

    + + @author Peter Marklund +} { + ns_log Notice "Starting instantiation and mounting of core packages" + + # Mount acs-lang + ns_log Notice "Mounting acs-lang" + set acs_lang_id [site_node::instantiate_and_mount -package_key acs-lang] + permission::grant -party_id [acs_magic_object the_public] \ + -object_id $acs_lang_id \ + -privilege read + + # Mount acs-admin + ns_log Notice "Mounting acs-admin" + site_node::instantiate_and_mount -package_key acs-admin + + # Mount acs-service-contract + ns_log Notice "Mounting acs-service-contract" + site_node::instantiate_and_mount -package_key acs-service-contract + + # Mount the acs-content-repository + ns_log Notice "Mounting acs-content-repository" + site_node::instantiate_and_mount -package_key acs-content-repository + + # Mount acs-core-docs + ns_log Notice "Mounting acs-core-docs" + site_node::instantiate_and_mount -node_name doc \ + -package_key acs-core-docs + + # Mount the acs-api-browser + ns_log Notice "Mounting acs-api-browser" + set api_browser_id \ + [site_node::instantiate_and_mount -node_name api-doc \ + -package_key acs-api-browser] + # Only registered users should have permission to access the + # api-browser + permission::grant -party_id [acs_magic_object registered_users] \ + -object_id $api_browser_id \ + -privilege read + permission::set_not_inherit -object_id $api_browser_id + + ns_log Notice "Core packages instantiated and mounted" +} + ############## # # Deprecated Procedures