Commit 34d343d0 authored by Frank Bergmann's avatar Frank Bergmann

- Updated to OpenACS 5.9.1

parent 6013d803
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -89,11 +89,16 @@
<msg key="common_Yes">Si</msg>
<msg key="common_yes">s</msg>
<msg key="Default_Context">Contexto por Defecto</msg>
<msg key="email_action_approved">Aprobar Email de %user_name%</msg>
<msg key="email_action_needs_approval">Requiere aprobacin de Email por %user_name%</msg>
<msg key="Email_Address">Direccin de correo</msg>
<msg key="Email_Addresses">Direccin de correo</msg>
<msg key="email_mail_approved">Su email en %site_name% ha sido aprobado. Por favor, visite %url%.</msg>
<msg key="email_mail_needs_approval">Su email en %site_name% requiere aprobacin. Por favor, visite %url%.</msg>
<msg key="First_Names">Nombre</msg>
<msg key="Group">Grupo</msg>
<msg key="Group_name">Nombre del grupo</msg>
<msg key="Group_names">Nombre de los grupos</msg>
<msg key="Groups">Grupos</msg>
<msg key="Last_Name">Apellidos</msg>
<msg key="Last_Names">Apellidos</msg>
......@@ -112,12 +117,32 @@
<msg key="member_role_pretty_name">miembro</msg>
<msg key="Member_role_pretty_plural">Miembros</msg>
<msg key="member_role_pretty_plural">miembros</msg>
<msg key="member_state_account_mail_approved">Su cuanta en %site_name% ha sido aprobada. Ya puede visitar %url%.</msg>
<msg key="member_state_account_mail_banned">Ha sido baneado de %site_name%.</msg>
<msg key="member_state_account_mail_deleted">Su cuenta en %site_name% ha sido eliminada.</msg>
<msg key="member_state_account_mail_merged">Su cuenta en %site_name% ha sido mezclada.</msg>
<msg key="member_state_account_mail_needs_approval">Su cuenta en %site_name% est esperando la aprobacin de un administrador.</msg>
<msg key="member_state_account_mail_rejected">Su cuenta en %site_name% ha sido rechazada.</msg>
<msg key="member_state_action_approved">Aprobar %user_name%</msg>
<msg key="member_state_action_banned">Banear %user_name%</msg>
<msg key="member_state_action_deleted">Borrar %user_name%</msg>
<msg key="member_state_action_merged">Mezclar %user_name%</msg>
<msg key="member_state_action_needs_approval">Requiere aprobacin del administrador para %user_name%</msg>
<msg key="member_state_action_rejected">Rechazar %user_name%</msg>
<msg key="member_state_Approved">Aprovado</msg>
<msg key="member_state_approved">aprobado</msg>
<msg key="member_state_Banned">Prohibido</msg>
<msg key="member_state_banned">prohibido</msg>
<msg key="member_state_community_mail_approved">Su pertenencia a la comunidad &#39;%community_name%&#39; ha sido aprobada. Ya puede visitar %url%</msg>
<msg key="member_state_community_mail_banned">Ha sido baneado de la comunidad &#39;%community_name%&#39;.</msg>
<msg key="member_state_community_mail_deleted">Su pertenencia a la comunidad &#39;%community_name%&#39; ha sido cancelada.</msg>
<msg key="member_state_community_mail_merged">Su pertenencia a la comunidad &#39;%community_name%&#39; ha sido mezclada.</msg>
<msg key="member_state_community_mail_needs_approval">Su pertenencia a la comunidad &#39;%community_name%&#39; est pendiente de aprobacin por parte de un administrador.</msg>
<msg key="member_state_community_mail_rejected">Su pertenencia a la comunidad &#39;%community_name%&#39; ha sido rechazada.</msg>
<msg key="member_state_Deleted">Borrado</msg>
<msg key="member_state_deleted">borrado</msg>
<msg key="member_state_Merged">fusionado</msg>
<msg key="member_state_merged">fusionado</msg>
<msg key="member_state_Needs_Approval">Necesita Aprobacin </msg>
<msg key="member_state_needs_approval">necesita aprobacin</msg>
<msg key="member_state_Rejected">Rechazado</msg>
......@@ -137,8 +162,10 @@
<msg key="Unregistered">No Registrado</msg>
<msg key="Unregistered_Visitor">Visitante No Registrado</msg>
<msg key="URL">URL</msg>
<msg key="URLs">URLs</msg>
<msg key="User">Usuario</msg>
<msg key="Username">Nombre de usuario</msg>
<msg key="Usernames">Nombres de usuario</msg>
<msg key="Users">Usuarios</msg>
<msg key="Visitor">Visitante</msg>
</message_catalog>
......@@ -34,10 +34,10 @@
<msg key="common_go">Accder</msg>
<msg key="common_Help">Aide</msg>
<msg key="common_help">Aide</msg>
<msg key="common_Login">S&#39;identifier</msg>
<msg key="common_login">s&#39;identifier</msg>
<msg key="common_Needs_Approval">A Besoin d&#39;une Approbation</msg>
<msg key="common_needs_approval">a besoin d&#39;une approbation</msg>
<msg key="common_Login">S'identifier</msg>
<msg key="common_login">s'identifier</msg>
<msg key="common_Needs_Approval">A Besoin d'une Approbation</msg>
<msg key="common_needs_approval">a besoin d'une approbation</msg>
<msg key="common_New">New</msg>
<msg key="common_new">nouveau</msg>
<msg key="common_Next">Suivant</msg>
......@@ -50,8 +50,8 @@
<msg key="common_open">Ouvrir</msg>
<msg key="common_Previous">Prcdent</msg>
<msg key="common_previous">Prcdent</msg>
<msg key="common_Register">S&#39;enregistrer</msg>
<msg key="common_register">s&#39;enregistrer</msg>
<msg key="common_Register">S'enregistrer</msg>
<msg key="common_register">s'enregistrer</msg>
<msg key="common_Repeat">Rpter</msg>
<msg key="common_repeat">Rpter</msg>
<msg key="common_Reset">Remise zro</msg>
......@@ -79,8 +79,8 @@
<msg key="member_state_banned">banni</msg>
<msg key="member_state_Deleted">Effac</msg>
<msg key="member_state_deleted">Supprim</msg>
<msg key="member_state_Needs_Approval">A Besoin d&#39;une Approbation</msg>
<msg key="member_state_needs_approval">a besoin d&#39;une approbation</msg>
<msg key="member_state_Needs_Approval">A Besoin d'une Approbation</msg>
<msg key="member_state_needs_approval">a besoin d'une approbation</msg>
<msg key="member_state_Rejected">Rejet</msg>
<msg key="member_state_rejected">rejet</msg>
</message_catalog>
......@@ -5,13 +5,17 @@
</msg>
<msg key="Administrators">Amministratori</msg>
<msg key="authentication_authority">Modalit di autenticazione</msg>
<msg key="Bio">Biografia</msg>
<msg key="Bios">Biografie</msg>
<msg key="common_Actions">Azioni</msg>
<msg key="common_actions">azioni</msg>
<msg key="common_Add">Aggiungi</msg>
<msg key="common_add">aggiungi</msg>
<msg key="common_Admin">Amministrazione</msg>
<msg key="common_Administration">Amministrazione</msg>
<msg key="common_administration">amministrazione</msg>
<msg key="common_All">tutti</msg>
<msg key="common_Any">Qualsiasi</msg>
<msg key="common_Apply">Applica</msg>
<msg key="common_apply">applica</msg>
<msg key="common_Cancel">Cancella</msg>
......@@ -58,10 +62,11 @@
<msg key="common_OK">OK</msg>
<msg key="common_ok">ok</msg>
<msg key="common_Open">Apri</msg>
<msg key="common_open">apri</msg>
<msg key="common_open">aperto</msg>
<msg key="common_Permissions">Permessi</msg>
<msg key="common_Previous">Precedente</msg>
<msg key="common_previous">precedente</msg>
<msg key="common_Print">Stampa</msg>
<msg key="common_Register">Registra</msg>
<msg key="common_register">registra</msg>
<msg key="common_Repeat">Ripeti</msg>
......@@ -83,18 +88,29 @@
<msg key="common_View">Mostra</msg>
<msg key="common_view">mostra</msg>
<msg key="common_Yes">S</msg>
<msg key="common_yes">S</msg>
<msg key="common_yes">s</msg>
<msg key="Default_Context">Contesto di default</msg>
<msg key="email_action_approved">Approva Email di %user_name%</msg>
<msg key="email_action_needs_approval">Richiedi approvazione Email per %user_name%</msg>
<msg key="Email_Address">Indirizzo email</msg>
<msg key="Email_Addresses">Indirizzo Email</msg>
<msg key="email_mail_approved">La tua email su %site_name% stata approvata. Visita per favore %url%.</msg>
<msg key="email_mail_needs_approval">La tua email su %site_name% richiede approvazione. Visita per favore %url%.</msg>
<msg key="First_Names">Nome</msg>
<msg key="Group">Gruppo</msg>
<msg key="Group_name">Nome Gruppo</msg>
<msg key="Group_names">Nomi Gruppo</msg>
<msg key="Groups">Gruppi</msg>
<msg key="Last_Name">Cognome</msg>
<msg key="lt_Administrator_Relatio">Relazione di admin</msg>
<msg key="Last_Names">Cognome/i</msg>
<msg key="lt_Administrator_Relatio">Relazione di Amministrazione</msg>
<msg key="lt_Administrator_Relatio_1">Relazioni di Amministrazione</msg>
<msg key="lt_Main_Site_Administrat">Amministratori del sito</msg>
<msg key="lt_Membership_Relationsh">Relazioni di Appartenenza</msg>
<msg key="lt_Relational_Constraint">Vincolo relazionale</msg>
<msg key="lt_Relational_Constraint_1">Vincoli relazionali</msg>
<msg key="lt_Relational_Party_Segm">Segmento Party relazionale</msg>
<msg key="lt_Relational_Party_Segm_1">Segmenti Party relazionali</msg>
<msg key="lt_Relational_Party_Segm">Segmento Relazionale Soggetto</msg>
<msg key="lt_Relational_Party_Segm_1">Segmenti Relazionali Soggetto</msg>
<msg key="lt_Security_context_root">Radice del contesto di sicurezza</msg>
<msg key="Main_Site">Sito</msg>
<msg key="Main_Site_Members">Membri del sito</msg>
......@@ -102,26 +118,55 @@
<msg key="member_role_pretty_name">partecipante</msg>
<msg key="Member_role_pretty_plural">Partecipanti</msg>
<msg key="member_role_pretty_plural">partecipanti</msg>
<msg key="member_state_account_mail_approved">Il tuo account su %site_name% stato approvato. Ora puoi utilizzare %url%.</msg>
<msg key="member_state_account_mail_banned">Sei stato bannato da %site_name%.</msg>
<msg key="member_state_account_mail_deleted">Il tuo account su %site_name% stato eliminato.</msg>
<msg key="member_state_account_mail_merged">Il tuo account su %site_name% stato fuso.</msg>
<msg key="member_state_account_mail_needs_approval">Il tuo account su %site_name% attende l&#39;approvazione di un amministratore.</msg>
<msg key="member_state_account_mail_rejected">Il tuo account su %site_name% stato rifiutato.</msg>
<msg key="member_state_action_approved">Approva %user_name%</msg>
<msg key="member_state_action_banned">Banna %user_name%</msg>
<msg key="member_state_action_deleted">Elimina %user_name%</msg>
<msg key="member_state_action_merged">Fondi %user_name%</msg>
<msg key="member_state_action_needs_approval">Richiedi Approvazione Admin per %user_name%</msg>
<msg key="member_state_action_rejected">Rifiuta %user_name%</msg>
<msg key="member_state_Approved">Approvato</msg>
<msg key="member_state_approved">approvato</msg>
<msg key="member_state_Banned">Bandito</msg>
<msg key="member_state_banned">bandito</msg>
<msg key="member_state_community_mail_approved">La tua adesione alla comunit %community_name% stata approvata. Ora puoi visitare %url%</msg>
<msg key="member_state_community_mail_banned">Sei stato bannato dalla comunit %community_name%.</msg>
<msg key="member_state_community_mail_deleted">La tua adesione alla comunit %community_name% stata eliminata.</msg>
<msg key="member_state_community_mail_merged">La tua adesione alla comunit %community_name% stata fusa.</msg>
<msg key="member_state_community_mail_needs_approval">La tua adesione alla comunit %community_name% attende l&#39;approvazione di un amministratore.</msg>
<msg key="member_state_community_mail_rejected">La tua adesione alla comunit %community_name% stata rifiutata.</msg>
<msg key="member_state_Deleted">Eliminato</msg>
<msg key="member_state_deleted">eliminato</msg>
<msg key="member_state_Merged">Fuso/a</msg>
<msg key="member_state_merged">fuso/a</msg>
<msg key="member_state_Needs_Approval">In attesa di Approvazione</msg>
<msg key="member_state_needs_approval">in attesa di approvazione</msg>
<msg key="member_state_Rejected">Rifiutato</msg>
<msg key="member_state_rejected">rifiutato</msg>
<msg key="Membership_Relation">Relazione di membership</msg>
<msg key="Party">Party</msg>
<msg key="Membership_Relation">Relazione di Appartenenza</msg>
<msg key="OpenACS_Local">Locale OpenACS</msg>
<msg key="Parties">Soggetti</msg>
<msg key="Party">Soggetto</msg>
<msg key="People">Persone</msg>
<msg key="Person">Persona</msg>
<msg key="Registered_Users">Utenti registrati</msg>
<msg key="registered_users">Utenti registrati</msg>
<msg key="Screen_Name">Nome Visualizzato</msg>
<msg key="Screen_Names">Nomi Visualizzati</msg>
<msg key="The_Public">Il pubblico</msg>
<msg key="the_public">Il pubblico</msg>
<msg key="Unregistered">Non registrato</msg>
<msg key="Unregistered_Visitor">Visitatore non registrato</msg>
<msg key="URL">URL</msg>
<msg key="URLs">URL</msg>
<msg key="User">Utente</msg>
<msg key="Username">Nome Utente</msg>
<msg key="Usernames">Nomi Utente</msg>
<msg key="Users">Utenti</msg>
<msg key="Visitor">Visitatore</msg>
</message_catalog>
......@@ -3,105 +3,93 @@
<msg key="Administrator">Beheerder</msg>
<msg key="Administrators">Beheerders</msg>
<msg key="authentication_authority">Autoriteit</msg>
<msg key="Bio">Biografie</msg>
<msg key="Bios">Biografien</msg>
<msg key="authentication_authority">Identiteitscontroleur</msg>
<msg key="common_Actions">Akties</msg>
<msg key="common_actions">akties</msg>
<msg key="common_Add">Toevoegen</msg>
<msg key="common_add">toevoegen</msg>
<msg key="common_Admin">Admin</msg>
<msg key="common_add">Toevoegen</msg>
<msg key="common_Administration">Administratie</msg>
<msg key="common_administration">administratie</msg>
<msg key="common_All">Alles</msg>
<msg key="common_Any">Iedere</msg>
<msg key="common_Apply">Toepassen</msg>
<msg key="common_apply">toepassen</msg>
<msg key="common_apply">Toepassen</msg>
<msg key="common_Cancel">Annuleren</msg>
<msg key="common_cancel">Annuleren</msg>
<msg key="common_Close">Sluiten</msg>
<msg key="common_close">sluiten</msg>
<msg key="common_close">Sluiten</msg>
<msg key="common_Closed">Gesloten</msg>
<msg key="common_closed">gesloten</msg>
<msg key="common_closed">Gesloten</msg>
<msg key="common_Continue">Doorgaan</msg>
<msg key="common_continue">doorgaan</msg>
<msg key="common_continue">Doorgaan</msg>
<msg key="common_Copy">Kopieer</msg>
<msg key="common_Default">Standaard gebruiken</msg>
<msg key="common_default">standaard gebruiken</msg>
<msg key="common_default">Standaard gebruiken</msg>
<msg key="common_Delete">Verwijderen</msg>
<msg key="common_delete">Verwijderen</msg>
<msg key="common_Details">Details</msg>
<msg key="common_details">details</msg>
<msg key="common_Discard">Negeren</msg>
<msg key="common_discard">negeren</msg>
<msg key="common_Discard">Wegdoen</msg>
<msg key="common_discard">Wegdoen</msg>
<msg key="common_Display">Tonen</msg>
<msg key="common_display">tonen</msg>
<msg key="common_Edit">Bewerken</msg>
<msg key="common_edit">bewerken</msg>
<msg key="common_edit">Bewerken</msg>
<msg key="common_Finish">Eindigen</msg>
<msg key="common_finish">eindigen</msg>
<msg key="common_finish">Eindigen</msg>
<msg key="common_First">Eerste</msg>
<msg key="common_first">eerste</msg>
<msg key="common_Go">Verder</msg>
<msg key="common_go">verder</msg>
<msg key="common_Go">Toon</msg>
<msg key="common_go">Toon</msg>
<msg key="common_Help">Hulp</msg>
<msg key="common_help">hulp</msg>
<msg key="common_help">Hulp</msg>
<msg key="common_Last">Laatste</msg>
<msg key="common_last">laatste</msg>
<msg key="common_Login">Aanmelden</msg>
<msg key="common_login">Aanmelden</msg>
<msg key="common_Needs_Approval">Toestemming nodig</msg>
<msg key="common_needs_approval">toestemming nodig</msg>
<msg key="common_needs_approval">Toestemming nodig</msg>
<msg key="common_New">Nieuw</msg>
<msg key="common_new">nieuw</msg>
<msg key="common_Next">Volgende</msg>
<msg key="common_next">volgende</msg>
<msg key="common_next">Volgende</msg>
<msg key="common_No">Nee</msg>
<msg key="common_no">nee</msg>
<msg key="common_OK">OK</msg>
<msg key="common_ok">OK</msg>
<msg key="common_Open">Open</msg>
<msg key="common_open">open</msg>
<msg key="common_Open">Openen</msg>
<msg key="common_open">Openen</msg>
<msg key="common_Permissions">Rechten</msg>
<msg key="common_Previous">Vorige</msg>
<msg key="common_previous">Vorige</msg>
<msg key="common_Print">Print</msg>
<msg key="common_Register">Registreren</msg>
<msg key="common_register">Inschrijven</msg>
<msg key="common_Repeat">Herhalen</msg>
<msg key="common_repeat">herhalen</msg>
<msg key="common_repeat">Herhalen</msg>
<msg key="common_Reset">Terugzetten</msg>
<msg key="common_reset">terugzetten</msg>
<msg key="common_reset">Terugzetten</msg>
<msg key="common_Save">Bewaren</msg>
<msg key="common_save">Opslaan</msg>
<msg key="common_Search">Zoeken</msg>
<msg key="common_search">zoeken</msg>
<msg key="common_Stop">Stoppen</msg>
<msg key="common_stop">stop</msg>
<msg key="common_stop">Stop</msg>
<msg key="common_Submit">Indienen</msg>
<msg key="common_submit">verzenden</msg>
<msg key="common_Title">Titel</msg>
<msg key="common_Type">Type</msg>
<msg key="common_Update">Bijwerken</msg>
<msg key="common_update">bijwerken</msg>
<msg key="common_update">Bijwerken</msg>
<msg key="common_View">Bekijken</msg>
<msg key="common_view">bekijken</msg>
<msg key="common_view">Bekijken</msg>
<msg key="common_Yes">Ja</msg>
<msg key="common_yes">ja</msg>
<msg key="common_yes">Ja</msg>
<msg key="Default_Context">Standaardcontekst</msg>
<msg key="Email_Address">E-mailadres</msg>
<msg key="Email_Addresses">Email addressen</msg>
<msg key="First_Names">Voornamen</msg>
<msg key="Group">Groep</msg>
<msg key="Group_name">Groepnaam</msg>
<msg key="Group_names">Group Names</msg>
<msg key="Groups">Groepen</msg>
<msg key="Last_Name">Achternaam</msg>
<msg key="Last_Names">Achternaam</msg>
<msg key="lt_Administrator_Relatio">Beheerderrelatie</msg>
<msg key="lt_Administrator_Relatio_1">Beheerder relaties</msg>
<msg key="lt_Main_Site_Administrat">Hoofdbeheerders</msg>
<msg key="lt_Membership_Relationsh">Lidmaatschap relaties</msg>
<msg key="lt_Relational_Constraint">Relationele randvoorwaarde</msg>
<msg key="lt_Relational_Constraint_1">Relationele randvoorwaarden</msg>
<msg key="lt_Relational_Party_Segm">Relationeel partijsegement</msg>
......@@ -118,32 +106,21 @@
<msg key="member_state_Banned">Uitgesloten</msg>
<msg key="member_state_banned">Uitgesloten</msg>
<msg key="member_state_Deleted">Verwijderd</msg>
<msg key="member_state_deleted">verwijderd</msg>
<msg key="member_state_Merged">Merged</msg>
<msg key="member_state_merged">merged</msg>
<msg key="member_state_deleted">Verwijderd</msg>
<msg key="member_state_Needs_Approval">Toestemming nodig</msg>
<msg key="member_state_needs_approval">Toestemming nodig</msg>
<msg key="member_state_Rejected">Afgewezen</msg>
<msg key="member_state_rejected">Geweigerd</msg>
<msg key="Membership_Relation">Lidmaatschaprelatie</msg>
<msg key="OpenACS_Local">OpenACS Local</msg>
<msg key="Parties">Partijen</msg>
<msg key="Party">Partij</msg>
<msg key="People">Mensen</msg>
<msg key="Person">Persoon</msg>
<msg key="Registered_Users">Geregistreerde gebruikers</msg>
<msg key="registered_users">Geregistreerde gebruikers</msg>
<msg key="Screen_Name">Schermnaam</msg>
<msg key="Screen_Names">Schermnamen</msg>
<msg key="The_Public">Het publiek</msg>
<msg key="the_public">Het publiek</msg>
<msg key="Unregistered">Ongeregistreerd</msg>
<msg key="Unregistered_Visitor">Ongeregistreerde gebruiker</msg>
<msg key="URL">URL</msg>
<msg key="URLs">URLs</msg>
<msg key="User">Gebruiker</msg>
<msg key="Username">Gebruikersnaam</msg>
<msg key="Usernames">Gebruikersnaam</msg>
<msg key="Users">Users</msg>
<msg key="Visitor">Bezoeker</msg>
</message_catalog>
--
-- acs-kernel/sql/acs-metadata-create.sql
--
-- A generic metadata system that allows table inheritence. This is
-- A generic metadata system that allows table inheritance. This is
-- based in many ways on Problem Set 4 by Philip Greenspun
-- (philg@mit.edu), and the user-groups data model by Tracy Adams
-- (teadams@mit.edu).
......@@ -867,7 +867,7 @@ is
-- Add the appropriate column to the table
-- We can only create the table column if
-- 1. the attribute is declared type_specific (generic storage uses an auxillary table)
-- 1. the attribute is declared type_specific (generic storage uses an auxiliary table)
-- 2. the attribute is not declared static
-- 3. it does not already exist in the table
......
......@@ -461,7 +461,7 @@ as
) return acs_objects.package_id%TYPE;
-- Determine where the attribute is stored and what sql needs to be
-- in the where clause to retreive it
-- in the where clause to retrieve it
-- Used in get_attribute and set_attribute
procedure get_attribute_storage (
object_id_in in acs_objects.object_id%TYPE,
......@@ -521,7 +521,7 @@ as
and a.storage = 'generic'
and a.static_p = 'f';
-- Retreive type for static attributes
-- Retrieve type for static attributes
select object_type into v_object_type from acs_objects
where object_id = initialize_attributes.object_id;
......@@ -804,7 +804,7 @@ as
end if;
else
-- Specific attribute: table name/column need to be retreived
-- Specific attribute: table name/column need to be retrieved
if v_static = 'f' then
select
......@@ -971,7 +971,7 @@ as
-- index contains each ancestor for OBJECT_ID. It doesn''t
-- guarantee that there aren''t extraneous rows or that
-- OBJECT_ID''s children are contained in the index. That is
-- verified by seperate functions.
-- verified by separate functions.
result := 't';
......@@ -1021,7 +1021,7 @@ as
-- N_GENERATIONS is how far the current DESCENDANT_ID is from
-- OBJECT_ID.
-- This function will verfy that each actualy descendant of
-- This function will verfy that each actually descendant of
-- OBJECT_ID has a row in the index table. It does not check that
-- there aren't extraneous rows or that the ancestors of OBJECT_ID
-- are maintained correctly.
......@@ -1086,7 +1086,7 @@ as
object_id || '.');
-- If this fails then there isn''t even an object associated with
-- this id. I'm going to let that error propogate as an exception.
-- this id. I'm going to let that error propagate as an exception.
select object_type into object_type
from acs_objects
where object_id = check_representation.object_id;
......
......@@ -194,8 +194,10 @@ where c.ancestor_id = p.object_id
and pdm.privilege = p.privilege
and pamm.party_id = p.grantee_id;
--
-- Kept to avoid breaking existing code, should eventually go away.
-- Obsolete and deprecated view.
--
create or replace view all_object_party_privilege_map as
select * from acs_object_party_privilege_map;
......
......@@ -52,6 +52,7 @@ create table acs_rel_types (
max_n_rels_two integer
constraint acs_rel_types_max_n_2_ck
check (max_n_rels_two >= 0),
composable_p boolean default 't' not null,
constraint acs_rel_types_n_rels_one_ck
check (min_n_rels_one <= max_n_rels_one),
constraint acs_rel_types_n_rels_two_ck
......
......@@ -143,11 +143,11 @@ create table apm_packages (
-- create bitmap index apm_packages_package_key_idx on apm_packages (package_key);
create index apm_packages_package_key_idx on apm_packages (package_key);
-- This cant be added at table create time since acs_objects is created before apm_packages;
-- This can't be added at table create time since acs_objects is created before apm_packages;
alter table acs_objects add constraint acs_objects_package_id_fk foreign key (package_id) references apm_packages(package_id) on delete set null;
comment on table apm_packages is '
This table maintains the list of all package instances in the sytem.
This table maintains the list of all package instances in the system.
';
comment on column apm_packages.instance_name is '
......@@ -515,7 +515,7 @@ comment on column apm_package_callbacks.type is '
values are given by the Tcl proc apm_supported_callback_types.
';
-- Ths view faciliates accessing information about package versions by joining
-- Ths view facilitates accessing information about package versions by joining
-- the apm_package_types information and acs_object_types information (which is
-- invariant across versions) with the specific version information.
......
......@@ -50,9 +50,10 @@ begin
raise_application_error(-20000,v_error);
end if;
select object_id_one, object_id_two, rel_type
select object_id_one, object_id_two, r.rel_type, composable_p
into v_object_id_one, v_object_id_two, v_rel_type
from acs_rels
from acs_rels r
join acs_rel_types t on (r.rel_type = t.rel_type)
where rel_id = :new.rel_id;
-- Insert a row for me in the group_member_index.
......@@ -67,23 +68,25 @@ begin
party_approved_member.add(v_object_id_one, v_object_id_two, v_rel_type);
end if;
-- For all groups of which I am a component, insert a
-- row in the group_member_index.
for map in (select distinct group_id
from group_component_map
where component_id = v_object_id_one) loop
insert into group_element_index
(group_id, element_id, rel_id, container_id,
rel_type, ancestor_rel_type)
values
(map.group_id, v_object_id_two, :new.rel_id, v_object_id_one,
v_rel_type, 'membership_rel');
if :new.member_state = 'approved' then
party_approved_member.add(map.group_id, v_object_id_two, v_rel_type);
end if;
if v_composable_p = 't' then
-- For all groups of which I am a component, insert a
-- row in the group_member_index.
for map in (select distinct group_id
from group_component_map
where component_id = v_object_id_one) loop
insert into group_element_index
(group_id, element_id, rel_id, container_id,
rel_type, ancestor_rel_type)
values
(map.group_id, v_object_id_two, :new.rel_id, v_object_id_one,
v_rel_type, 'membership_rel');
if :new.member_state = 'approved' then
party_approved_member.add(map.group_id, v_object_id_two, v_rel_type);
end if;
end loop;
end loop;
end if;
end;
/
show errors
......@@ -157,15 +160,17 @@ begin
party_approved_member.add(v_object_id_one, members.member_id, members.rel_type);
end loop;
-- Make my elements be elements of my new composite group
-- Make my composable elements be elements of my new composite group
insert into group_element_index
(group_id, element_id, rel_id, container_id,
rel_type, ancestor_rel_type)
select distinct
v_object_id_one, element_id, rel_id, container_id,
rel_type, ancestor_rel_type
m.rel_type, ancestor_rel_type
from group_element_map m
join acs_rel_types t on (m.rel_type = t.rel_type)
where group_id = v_object_id_two
and t.composable_p = 't'
and not exists (select 1
from group_element_map
where group_id = v_object_id_one
......@@ -173,7 +178,7 @@ begin
and rel_id = m.rel_id);
-- For all direct or indirect containers of my new composite group,
-- add me and add my elements
-- add me and add my composable elements
for map in (select distinct group_id
from group_component_map
where component_id = v_object_id_one) loop
......@@ -186,11 +191,13 @@ begin
(map.group_id, v_object_id_two, :new.rel_id, v_object_id_one,
v_rel_type, 'composition_rel');
-- Add rows for my elements
-- Add rows for my composable elements
for members in (select distinct member_id, rel_type
from group_approved_member_map m
join acs_rel_types t on (m.rel_type = t.rel_type)
where group_id = v_object_id_two
and t.composable_p = 't'
and not exists (select 1
from group_element_map
where group_id = map.group_id
......@@ -207,7 +214,9 @@ begin
map.group_id, element_id, rel_id, container_id,
rel_type, ancestor_rel_type
from group_element_map m
join acs_rel_types t on (m.rel_type = t.rel_type)
where group_id = v_object_id_two
and t.composable_p = 't'
and not exists (select 1
from group_element_map
where group_id = map.group_id
......@@ -877,7 +886,7 @@ is
else
select count(*)
into m_result
from acs_rels rels, all_object_party_privilege_map perm
from acs_rels rels, acs_object_party_privilege_map perm
where perm.object_id = rels.rel_id
and perm.privilege = 'read'
and rels.rel_type = 'membership_rel'
......
......@@ -89,7 +89,8 @@ begin
object_type_one => 'group', role_one => 'composite',
min_n_rels_one => 0, max_n_rels_one => null,
object_type_two => 'group', role_two => 'component',
min_n_rels_two => 0, max_n_rels_two => null
min_n_rels_two => 0, max_n_rels_two => null,
composable_p => 't'
);
--
......@@ -107,7 +108,8 @@ begin
object_type_one => 'group',
min_n_rels_one => 0, max_n_rels_one => null,
object_type_two => 'person', role_two => 'member',
min_n_rels_two => 0, max_n_rels_two => null
min_n_rels_two => 0, max_n_rels_two => null,
composable_p => 't'
);
acs_rel_type.create_role ('admin', 'Administrator', 'Administrators');
......@@ -123,7 +125,8 @@ begin
object_type_one => 'group',
min_n_rels_one => 0, max_n_rels_one => null,
object_type_two => 'person', role_two => 'admin',
min_n_rels_two => 0, max_n_rels_two => null
min_n_rels_two => 0, max_n_rels_two => null,
composable_p => 'f'
);
commit;
......@@ -311,7 +314,7 @@ create or replace view group_distinct_member_map
as select distinct group_id, member_id
from group_approved_member_map;
-- some more views, like party_memeber_map and party_approved_member_map,
-- some more views, like party_member_map and party_approved_member_map,
-- are created in rel-segments-create.sql
-- Just in case someone is still querying the group_component_index and
......@@ -388,7 +391,7 @@ show errors
---------------------------------------------
-- POPULATE DATA FOR PERMISSABLE REL TYPES --
-- POPULATE DATA FOR PERMISSIBLE REL TYPES --
---------------------------------------------
-- define standard types for groups of type 'group'
......
......@@ -17,7 +17,7 @@ create table site_node_object_mappings (
constraint snom_node_id_nn
not null
);
create index site_node_object_mappings_node_id_idx on site_node_object_mappings(node_id);
create index site_node_obj_map_node_id_idx on site_node_object_mappings(node_id);
create or replace package site_node_object_map
as
......
......@@ -47,7 +47,7 @@ create table site_nodes (
);
create index site_nodes_object_id_idx on site_nodes (object_id);
create index site_nodes_parent_object_node_id_idx on site_nodes(parent_id, object_id, node_id);
create index site_nodes_parent_obj_node_idx on site_nodes(parent_id, object_id, node_id);
create index site_nodes_parent_id_idx on site_nodes(parent_id);
......
......@@ -272,7 +272,7 @@ begin
rel_constraint.del(side_one_constraint);
rel_constraint.del(side_two_constraint);
-- Remove the test memebership relations
-- Remove the test membership relations
for r in (select * from blah_member_rels) loop
blah_member_rel.del(r.rel_id);
end loop;
......
......@@ -10,7 +10,8 @@ begin
object_type_one => 'group',
min_n_rels_one => 0, max_n_rels_one => null,
object_type_two => 'party', role_two => 'member',
min_n_rels_two => 0, max_n_rels_two => null
min_n_rels_two => 0, max_n_rels_two => null,
composable_p => 't'
);
......@@ -25,7 +26,8 @@ begin
object_type_one => 'group',
min_n_rels_one => 0, max_n_rels_one => null,
object_type_two => 'party', role_two => 'member',
min_n_rels_two => 0, max_n_rels_two => null
min_n_rels_two => 0, max_n_rels_two => null,
composable_p => 't'
);
end;
/
......
......@@ -222,7 +222,7 @@ begin
acs_rel_segment.del(seg_E_yippes);
acs_rel_segment.del(acs_rel_segment.get(F,'membership_rel'));
-- Remove the test memebership relations
-- Remove the test membership relations
for r in (select * from blah_member_rels) loop
blah_member_rel.del(r.rel_id);
end loop;
......
......@@ -1162,7 +1162,7 @@ where rc_required_rel_segments.group_id(+) = group_rel_type_party_combos.group_i
-- Question: Given relation :rel_id
--
-- If we were to remove the relation specified by rel_id,
-- what constraints would be violated and by waht parties?
-- what constraints would be violated and by what parties?
--
-- Answer: select r.rel_id, r.constraint_id, r.constraint_name
-- acs_object_type.pretty_name(r.rel_type) as rel_type_pretty_name,
......
......@@ -59,7 +59,7 @@ as
) return varchar2;
-- Determine where the attribute is stored and what sql needs to be
-- in the where clause to retreive it
-- in the where clause to retrieve it
-- Used in get_attribute and set_attribute
procedure get_attribute_storage (
object_id_in in acs_objects.object_id%TYPE,
......@@ -117,7 +117,7 @@ as
and a.storage = 'generic'
and a.static_p = 'f';
-- Retreive type for static attributes
-- Retrieve type for static attributes
select object_type into v_object_type from acs_objects
where object_id = initialize_attributes.object_id;
......@@ -339,7 +339,7 @@ as
end if;
else
-- Specific attribute: table name/column need to be retreived
-- Specific attribute: table name/column need to be retrieved
if v_static = 'f' then
select
......@@ -506,7 +506,7 @@ as
-- index contains each ancestor for OBJECT_ID. It doesn''t
-- guarantee that there aren''t extraneous rows or that
-- OBJECT_ID''s children are contained in the index. That is
-- verified by seperate functions.
-- verified by separate functions.
result := 't';
......@@ -556,7 +556,7 @@ as
-- N_GENERATIONS is how far the current DESCENDANT_ID is from
-- OBJECT_ID.
-- This function will verfy that each actualy descendant of
-- This function will verfy that each actually descendant of
-- OBJECT_ID has a row in the index table. It does not check that
-- there aren't extraneous rows or that the ancestors of OBJECT_ID
-- are maintained correctly.
......@@ -621,7 +621,7 @@ as
object_id || '.');
-- If this fails then there isn''t even an object associated with
-- this id. I'm going to let that error propogate as an exception.
-- this id. I'm going to let that error propagate as an exception.
select object_type into object_type
from acs_objects
where object_id = check_representation.object_id;
......
......@@ -37,7 +37,7 @@ as
and a.storage = 'generic'
and a.static_p = 'f';
-- Retreive type for static attributes
-- Retrieve type for static attributes
select object_type into v_object_type from acs_objects
where object_id = initialize_attributes.object_id;
......@@ -269,7 +269,7 @@ as
end if;
else
-- Specific attribute: table name/column need to be retreived
-- Specific attribute: table name/column need to be retrieved
if v_static = 'f' then
select
......@@ -436,7 +436,7 @@ as
-- index contains each ancestor for OBJECT_ID. It doesn''t
-- guarantee that there aren''t extraneous rows or that
-- OBJECT_ID''s children are contained in the index. That is
-- verified by seperate functions.
-- verified by separate functions.
result := 't';
......@@ -486,7 +486,7 @@ as
-- N_GENERATIONS is how far the current DESCENDANT_ID is from
-- OBJECT_ID.
-- This function will verfy that each actualy descendant of
-- This function will verfy that each actually descendant of
-- OBJECT_ID has a row in the index table. It does not check that
-- there aren't extraneous rows or that the ancestors of OBJECT_ID
-- are maintained correctly.
......@@ -551,7 +551,7 @@ as
object_id || '.');
-- If this fails then there isn''t even an object associated with
-- this id. I'm going to let that error propogate as an exception.
-- this id. I'm going to let that error propagate as an exception.
select object_type into object_type
from acs_objects
where object_id = check_representation.object_id;
......
......@@ -32,7 +32,7 @@ as
) return varchar2;
-- Determine where the attribute is stored and what sql needs to be
-- in the where clause to retreive it
-- in the where clause to retrieve it
-- Used in get_attribute and set_attribute
procedure get_attribute_storage (
object_id_in in acs_objects.object_id%TYPE,
......@@ -92,7 +92,7 @@ as
and a.storage = 'generic'
and a.static_p = 'f';
-- Retreive type for static attributes
-- Retrieve type for static attributes
select object_type into v_object_type from acs_objects
where object_id = initialize_attributes.object_id;
......@@ -324,7 +324,7 @@ as
end if;
else
-- Specific attribute: table name/column need to be retreived
-- Specific attribute: table name/column need to be retrieved
if v_static = 'f' then
select
......@@ -491,7 +491,7 @@ as
-- index contains each ancestor for OBJECT_ID. It doesn''t
-- guarantee that there aren''t extraneous rows or that
-- OBJECT_ID''s children are contained in the index. That is
-- verified by seperate functions.
-- verified by separate functions.
result := 't';
......@@ -541,7 +541,7 @@ as
-- N_GENERATIONS is how far the current DESCENDANT_ID is from
-- OBJECT_ID.
-- This function will verfy that each actualy descendant of
-- This function will verfy that each actually descendant of
-- OBJECT_ID has a row in the index table. It does not check that
-- there aren't extraneous rows or that the ancestors of OBJECT_ID
-- are maintained correctly.
......@@ -606,7 +606,7 @@ as
object_id || '.');
-- If this fails then there isn''t even an object associated with
-- this id. I'm going to let that error propogate as an exception.
-- this id. I'm going to let that error propagate as an exception.
select object_type into object_type
from acs_objects
where object_id = check_representation.object_id;
......
......@@ -22,7 +22,7 @@ as
and a.storage = 'generic'
and a.static_p = 'f';
-- Retreive type for static attributes
-- Retrieve type for static attributes
select object_type into v_object_type from acs_objects
where object_id = initialize_attributes.object_id;
......@@ -257,7 +257,7 @@ as
end if;
else
-- Specific attribute: table name/column need to be retreived
-- Specific attribute: table name/column need to be retrieved
if v_static = 'f' then
select
......@@ -424,7 +424,7 @@ as
-- index contains each ancestor for OBJECT_ID. It doesn''t
-- guarantee that there aren''t extraneous rows or that
-- OBJECT_ID''s children are contained in the index. That is
-- verified by seperate functions.
-- verified by separate functions.
result := 't';
......@@ -474,7 +474,7 @@ as
-- N_GENERATIONS is how far the current DESCENDANT_ID is from
-- OBJECT_ID.
-- This function will verfy that each actualy descendant of
-- This function will verfy that each actually descendant of
-- OBJECT_ID has a row in the index table. It does not check that
-- there aren't extraneous rows or that the ancestors of OBJECT_ID
-- are maintained correctly.
......@@ -539,7 +539,7 @@ as
object_id || '.');
-- If this fails then there isn''t even an object associated with
-- this id. I'm going to let that error propogate as an exception.
-- this id. I'm going to let that error propagate as an exception.
select object_type into object_type
from acs_objects
where object_id = check_representation.object_id;
......
......@@ -39,7 +39,7 @@ as
) return varchar2;
-- Determine where the attribute is stored and what sql needs to be
-- in the where clause to retreive it
-- in the where clause to retrieve it
-- Used in get_attribute and set_attribute
procedure get_attribute_storage (
object_id_in in acs_objects.object_id%TYPE,
......@@ -100,7 +100,7 @@ as
and a.storage = 'generic'
and a.static_p = 'f';
-- Retreive type for static attributes
-- Retrieve type for static attributes
select object_type into v_object_type from acs_objects
where object_id = initialize_attributes.object_id;
......@@ -332,7 +332,7 @@ as
end if;
else
-- Specific attribute: table name/column need to be retreived
-- Specific attribute: table name/column need to be retrieved
if v_static = 'f' then
select
......@@ -499,7 +499,7 @@ as
-- index contains each ancestor for OBJECT_ID. It doesn''t
-- guarantee that there aren''t extraneous rows or that
-- OBJECT_ID''s children are contained in the index. That is
-- verified by seperate functions.
-- verified by separate functions.
result := 't';
......@@ -549,7 +549,7 @@ as
-- N_GENERATIONS is how far the current DESCENDANT_ID is from
-- OBJECT_ID.
-- This function will verfy that each actualy descendant of
-- This function will verfy that each actually descendant of
-- OBJECT_ID has a row in the index table. It does not check that
-- there aren't extraneous rows or that the ancestors of OBJECT_ID
-- are maintained correctly.
......@@ -614,7 +614,7 @@ as
object_id || '.');
-- If this fails then there isn''t even an object associated with
-- this id. I'm going to let that error propogate as an exception.
-- this id. I'm going to let that error propagate as an exception.
select object_type into object_type
from acs_objects
where object_id = check_representation.object_id;
......
......@@ -52,7 +52,7 @@ as
) return varchar2;
-- Determine where the attribute is stored and what sql needs to be
-- in the where clause to retreive it
-- in the where clause to retrieve it
-- Used in get_attribute and set_attribute
procedure get_attribute_storage (
object_id_in in acs_objects.object_id%TYPE,
......@@ -112,7 +112,7 @@ as
and a.storage = 'generic'
and a.static_p = 'f';
-- Retreive type for static attributes
-- Retrieve type for static attributes
select object_type into v_object_type from acs_objects
where object_id = initialize_attributes.object_id;
......@@ -344,7 +344,7 @@ as
end if;
else
-- Specific attribute: table name/column need to be retreived
-- Specific attribute: table name/column need to be retrieved
if v_static = 'f' then
select
......@@ -511,7 +511,7 @@ as
-- index contains each ancestor for OBJECT_ID. It doesn''t
-- guarantee that there aren''t extraneous rows or that
-- OBJECT_ID''s children are contained in the index. That is
-- verified by seperate functions.
-- verified by separate functions.
result := 't';
......@@ -561,7 +561,7 @@ as
-- N_GENERATIONS is how far the current DESCENDANT_ID is from
-- OBJECT_ID.
-- This function will verfy that each actualy descendant of
-- This function will verfy that each actually descendant of
-- OBJECT_ID has a row in the index table. It does not check that
-- there aren't extraneous rows or that the ancestors of OBJECT_ID
-- are maintained correctly.
......@@ -626,7 +626,7 @@ as
object_id || '.');
-- If this fails then there isn''t even an object associated with
-- this id. I'm going to let that error propogate as an exception.
-- this id. I'm going to let that error propagate as an exception.
select object_type into object_type
from acs_objects
where object_id = check_representation.object_id;
......
......@@ -33,7 +33,7 @@ as
) return varchar2;
-- Determine where the attribute is stored and what sql needs to be
-- in the where clause to retreive it
-- in the where clause to retrieve it
-- Used in get_attribute and set_attribute
procedure get_attribute_storage (
object_id_in in acs_objects.object_id%TYPE,
......@@ -93,7 +93,7 @@ as
and a.storage = 'generic'
and a.static_p = 'f';
-- Retreive type for static attributes
-- Retrieve type for static attributes
select object_type into v_object_type from acs_objects
where object_id = initialize_attributes.object_id;
......@@ -336,7 +336,7 @@ as
end if;
else
-- Specific attribute: table name/column need to be retreived
-- Specific attribute: table name/column need to be retrieved
if v_static = 'f' then
select
......@@ -503,7 +503,7 @@ as
-- index contains each ancestor for OBJECT_ID. It doesn''t
-- guarantee that there aren''t extraneous rows or that
-- OBJECT_ID''s children are contained in the index. That is
-- verified by seperate functions.
-- verified by separate functions.
result := 't';
......@@ -553,7 +553,7 @@ as
-- N_GENERATIONS is how far the current DESCENDANT_ID is from
-- OBJECT_ID.
-- This function will verfy that each actualy descendant of
-- This function will verfy that each actually descendant of
-- OBJECT_ID has a row in the index table. It does not check that
-- there aren't extraneous rows or that the ancestors of OBJECT_ID
-- are maintained correctly.
......@@ -618,7 +618,7 @@ as
object_id || '.');
-- If this fails then there isn''t even an object associated with
-- this id. I'm going to let that error propogate as an exception.
-- this id. I'm going to let that error propagate as an exception.
select object_type into object_type
from acs_objects
where object_id = check_representation.object_id;
......
......@@ -181,7 +181,7 @@ as
) return acs_objects.package_id%TYPE;
-- Determine where the attribute is stored and what sql needs to be
-- in the where clause to retreive it
-- in the where clause to retrieve it
-- Used in get_attribute and set_attribute
procedure get_attribute_storage (
object_id_in in acs_objects.object_id%TYPE,
......@@ -241,7 +241,7 @@ as
and a.storage = 'generic'
and a.static_p = 'f';
-- Retreive type for static attributes
-- Retrieve type for static attributes
select object_type into v_object_type from acs_objects
where object_id = initialize_attributes.object_id;
......@@ -524,7 +524,7 @@ as
end if;
else
-- Specific attribute: table name/column need to be retreived
-- Specific attribute: table name/column need to be retrieved
if v_static = 'f' then
select
......@@ -691,7 +691,7 @@ as
-- index contains each ancestor for OBJECT_ID. It doesn''t
-- guarantee that there aren''t extraneous rows or that
-- OBJECT_ID''s children are contained in the index. That is
-- verified by seperate functions.
-- verified by separate functions.
result := 't';
......@@ -741,7 +741,7 @@ as
-- N_GENERATIONS is how far the current DESCENDANT_ID is from
-- OBJECT_ID.
-- This function will verfy that each actualy descendant of
-- This function will verfy that each actually descendant of
-- OBJECT_ID has a row in the index table. It does not check that
-- there aren't extraneous rows or that the ancestors of OBJECT_ID
-- are maintained correctly.
......@@ -806,7 +806,7 @@ as
object_id || '.');
-- If this fails then there isn''t even an object associated with
-- this id. I'm going to let that error propogate as an exception.
-- this id. I'm going to let that error propagate as an exception.
select object_type into object_type
from acs_objects
where object_id = check_representation.object_id;
......
......@@ -320,7 +320,7 @@ as
and a.storage = 'generic'
and a.static_p = 'f';
-- Retreive type for static attributes
-- Retrieve type for static attributes
select object_type into v_object_type from acs_objects
where object_id = initialize_attributes.object_id;
......@@ -603,7 +603,7 @@ as
end if;
else
-- Specific attribute: table name/column need to be retreived
-- Specific attribute: table name/column need to be retrieved
if v_static = 'f' then
select
......@@ -770,7 +770,7 @@ as
-- index contains each ancestor for OBJECT_ID. It doesn''t
-- guarantee that there aren''t extraneous rows or that
-- OBJECT_ID''s children are contained in the index. That is
-- verified by seperate functions.
-- verified by separate functions.
result := 't';
......@@ -820,7 +820,7 @@ as
-- N_GENERATIONS is how far the current DESCENDANT_ID is from
-- OBJECT_ID.
-- This function will verfy that each actualy descendant of
-- This function will verfy that each actually descendant of
-- OBJECT_ID has a row in the index table. It does not check that
-- there aren't extraneous rows or that the ancestors of OBJECT_ID
-- are maintained correctly.
......@@ -885,7 +885,7 @@ as
object_id || '.');
-- If this fails then there isn''t even an object associated with
-- this id. I'm going to let that error propogate as an exception.
-- this id. I'm going to let that error propagate as an exception.
select object_type into object_type
from acs_objects
where object_id = check_representation.object_id;
......
......@@ -547,7 +547,7 @@ is
-- Add the appropriate column to the table
-- We can only create the table column if
-- 1. the attribute is declared type_specific (generic storage uses an auxillary table)
-- 1. the attribute is declared type_specific (generic storage uses an auxiliary table)
-- 2. the attribute is not declared static
-- 3. it does not already exist in the table
......
drop index site_nodes_parent_id_idx;
create index site_nodes_parent_object_node_id_idx on site_nodes(parent_id, object_id, node_id);
create index site_nodes_parent_obj_node_idx on site_nodes(parent_id, object_id, node_id);
create index site_nodes_parent_id_idx on site_nodes(parent_id);
create index site_node_object_mappings_node_id_idx on site_node_object_mappings(node_id);
create index site_node_obj_map_node_id_idx on site_node_object_mappings(node_id);
PROMPT starting utilities-create.sql....
--
-- /packages/acs-kernel/sql/utilities-create.sql
--
......@@ -82,8 +83,23 @@ as
name IN varchar2)
return boolean
as
v_count integer;
v_exists boolean;
begin
return exists (select 1 from user_tables where table_name = t_name);
select decode(count(*),0,0,1) into v_count
from user_tables where table_name = upper(table_exists.name);
if v_count = 1 then
v_exists := true;
else
v_exists := false;
end if;
return v_exists;
END table_exists;
function table_column_exists (
......@@ -91,24 +107,65 @@ as
c_name IN varchar2)
return boolean
as
v_count integer;
v_exists boolean;
begin
return exists (select 1 from user_tab_columns where c.table_name = t_name and c.column_name = c_name);
select decode(count(*),0,0,1) into v_count from user_tab_columns
where table_name = upper(table_column_exists.t_name)
and column_name = upper(table_column_exists.c_name);
if v_count = 1 then
v_exists := true;
else
v_exists := false;
end if;
return v_exists;
END table_column_exists;
function view_exists (
name IN varchar2)
return boolean
as
v_count integer;
v_exists boolean;
begin
return exists (select 1 from user_views where view_name = name);
select decode(count(*),0,0,1) into v_count
from user_views where view_name = upper(view_exists.name);
if v_count = 1 then
v_exists := true;
else
v_exists := false;
end if;
return v_exists;
END view_exists;
function index_exists (
name IN varchar2)
return boolean
as
v_count integer;
v_exists boolean;
begin
return exists (select 1 from user_indexes where index_name = name);
select decode(count(*),0,0,1) into v_count
from user_indexes where index_name = upper(index_exists.name);
if v_count = 1 then
v_exists := true;
else
v_exists := false;
end if;
return v_exists;
END index_exists;
end util;
......
......@@ -13,10 +13,65 @@ create table acs_magic_objects (
references acs_objects(object_id)
);
comment on table acs_magic_objects is '
comment on table acs_magic_objects is $$
This table allows us to provide semantic names for certain special
objects like the site-wide organization, and the all users party.
';
$$;
-- The very first thing we must do is create the security_context_root
-- object.
-- added
select define_function_args('acs__magic_object_id','name');
--
-- procedure acs__magic_object_id/1
--
CREATE OR REPLACE FUNCTION acs__magic_object_id(
magic_object_id__name varchar
) RETURNS integer AS $$
DECLARE
BEGIN
return object_id
from acs_magic_objects
where name = magic_object_id__name;
END;
$$ LANGUAGE plpgsql stable strict;
--
-- procedure inline_0/0
--
CREATE OR REPLACE FUNCTION inline_0(
) RETURNS integer AS $$
DECLARE
root_id integer;
BEGIN
root_id := acs_object__new (
-4,
'acs_object',
now(),
null,
null,
null,
't',
'#acs-kernel.lt_Security_context_root#',
null
);
insert into acs_magic_objects
(name, object_id)
values
('security_context_root', -4);
return root_id;
END;
$$ LANGUAGE plpgsql;
select inline_0();
drop function inline_0 ();
......@@ -127,22 +182,7 @@ $$ LANGUAGE plpgsql;
-- added
--
-- procedure acs__magic_object_id/1
--
CREATE OR REPLACE FUNCTION acs__magic_object_id(
magic_object_id__name varchar
) RETURNS integer AS $$
DECLARE
BEGIN
return object_id
from acs_magic_objects
where name = magic_object_id__name;
END;
-- ******************************************************************
-- * Community Core API
......@@ -190,51 +230,6 @@ where o.object_id = pa.party_id
-- Community Core Initialization --
-----------------------------------
-- The very first thing we must do is create the security_context_root
-- object.
--
-- procedure inline_0/0
--
CREATE OR REPLACE FUNCTION inline_0(
) RETURNS integer AS $$
DECLARE
root_id integer;
BEGIN
root_id := acs_object__new (
-4,
'acs_object',
now(),
null,
null,
null,
't',
'#acs-kernel.lt_Security_context_root#',
null
);
insert into acs_magic_objects
(name, object_id)
values
('security_context_root', -4);
return root_id;
END;
$$ LANGUAGE plpgsql;
select inline_0 ();
drop function inline_0 ();
-- show errors
begin;
--------------------------------------------------------------
......@@ -283,6 +278,15 @@ BEGIN
values
(0, 'user', '#acs-kernel.Unregistered_Visitor#');
--
-- Create an "identity relationship" (needs acs-object 0 and magic object 'unregistered_visitor')
--
perform acs_object__new(-10, 'relationship');
insert into acs_rels (rel_id, rel_type, object_id_one, object_id_two) values (-10, 'relationship', 0, 0);
--
-- Insert user 0 into parties, persons, users and acs_magic_objects
--
insert into parties
(party_id)
values
......@@ -334,12 +338,10 @@ BEGIN
null);
return 0;
END;
$$ LANGUAGE plpgsql;
select inline_2 ();
drop function inline_2 ();
......@@ -379,12 +381,13 @@ BEGIN
-- Users" group
perform composition_rel__new (
null,
null, -- rel_id
'composition_rel',
acs__magic_object_id('the_public'),
acs__magic_object_id('registered_users'),
null,
null);
null, -- creation_user
null -- creation_ip
);
return 0;
END;
......
......@@ -8,7 +8,8 @@
-- @cvs-id $Id$
--
-- set feedback off
--\set ECHO queries
\set VERBOSITY 'verbose'
\i postgresql.sql
\i lob.sql
......@@ -32,9 +33,8 @@
\i site-nodes-create.sql
\i site-node-object-map-create.sql
\i apm-create.sql
\i acs-create.sql
\i acs-create.sql
\i acs-create-2.sql
--
-- set feedback on
--
-- acs-kernel/sql/acs-metadata-create.sql
--
-- A generic metadata system that allows table inheritence. This is
-- A generic metadata system that allows table inheritance. This is
-- based in many ways on Problem Set 4 by Philip Greenspun
-- (philg@mit.edu), and the user-groups data model by Tracy Adams
-- (teadams@mit.edu).
......@@ -26,7 +26,7 @@
create table acs_object_types (
object_type varchar(1000) not null
constraint acs_object_types_pk primary key,
supertype varchar(100) constraint acs_object_types_supertype_fk
supertype varchar(1000) constraint acs_object_types_supertype_fk
references acs_object_types (object_type),
abstract_p boolean default 'f' not null,
pretty_name varchar(1000) not null
......@@ -261,7 +261,7 @@ as select ot1.object_type, ot2.object_type as ancestor_type
and ot1.tree_sortkey between ot2.tree_sortkey and tree_right(ot2.tree_sortkey);
create table acs_object_type_tables (
object_type varchar(100) not null
object_type varchar(1000) not null
constraint acs_obj_type_tbls_obj_type_fk
references acs_object_types (object_type),
table_name varchar(30) not null,
......@@ -449,7 +449,7 @@ create table acs_attributes (
attribute_id integer not null
constraint acs_attributes_attribute_id_pk
primary key,
object_type varchar(100) not null
object_type varchar(1000) not null
constraint acs_attributes_object_type_fk
references acs_object_types (object_type),
table_name varchar(30),
......@@ -547,7 +547,7 @@ create table acs_enum_values (
create index acs_enum_values_attr_id_idx on acs_enum_values (attribute_id);
create table acs_attribute_descriptions (
object_type varchar(100) not null constraint acs_attr_descs_obj_type_fk
object_type varchar(1000) not null constraint acs_attr_descs_obj_type_fk
references acs_object_types (object_type),
attribute_name varchar(100) not null,
constraint acs_attr_descs_ob_tp_at_na_fk
......@@ -960,7 +960,7 @@ BEGIN
-- Add the appropriate column to the table
-- We can only create the table column if
-- 1. the attribute is declared type_specific (generic storage uses an auxillary table)
-- 1. the attribute is declared type_specific (generic storage uses an auxiliary table)
-- 2. the attribute is not declared static
-- 3. it does not already exist in the table
......
......@@ -230,13 +230,14 @@ select nextval('t_acs_object_id_seq') as nextval;
create table acs_objects (
object_id integer not null
constraint acs_objects_object_id_pk primary key,
object_type varchar(100) not null
object_type varchar(1000) not null
constraint acs_objects_object_type_fk
references acs_object_types (object_type),
title varchar(1000) default null,
package_id integer default null,
context_id integer constraint acs_objects_context_id_fk
references acs_objects(object_id),
context_id integer
CONSTRAINT acs_objects_context_id_fk
REFERENCES acs_objects(object_id) ON DELETE CASCADE,
security_inherit_p boolean default 't' not null,
creation_user integer,
creation_date timestamptz default current_timestamp not null,
......@@ -290,19 +291,19 @@ for each row execute procedure acs_objects_last_mod_update_tr ();
-- show errors
comment on table acs_objects is '
The root table for the acs object heirarchy. It all starts here folks.
The root table for the acs object hierarchy. It all starts here folks.
';
comment on column acs_objects.context_id is '
comment on column acs_objects.context_id is $$
The context_id column points to an object that provides a context for
this object. Often this will reflect an observed hierarchy in a site,
for example a bboard message would probably list a bboard topic as
it''s context, and a bboard topic might list a sub-site as it''s
it's context, and a bboard topic might list a sub-site as it's
context. Whenever we ask a question of the form "can user X perform
action Y on object Z", the acs security model will defer to an
object''s context if there is no information about user X''s
object's context if there is no information about user X's
permission to perform action Y on object Z.
';
$$;
comment on column acs_objects.creation_user is '
Who created the object; may be null since objects can be created by
......@@ -331,11 +332,11 @@ comment on column acs_objects.title is '
create table acs_object_context_index (
object_id integer not null
constraint acs_obj_context_idx_obj_id_fk
references acs_objects(object_id),
CONSTRAINT acs_obj_context_idx_obj_id_fk
REFERENCES acs_objects(object_id) ON DELETE CASCADE,
ancestor_id integer not null
constraint acs_obj_context_idx_anc_id_fk
references acs_objects(object_id),
CONSTRAINT acs_obj_context_idx_anc_id_fk
REFERENCES acs_objects(object_id) ON DELETE CASCADE,
n_generations integer not null
constraint acs_obj_context_idx_n_gen_ck
check (n_generations >= 0),
......@@ -477,19 +478,6 @@ $$ LANGUAGE plpgsql;
create trigger acs_objects_context_id_up_tr after update on acs_objects
for each row execute procedure acs_objects_context_id_up_tr ();
CREATE OR REPLACE FUNCTION acs_objects_context_id_del_tr () RETURNS trigger AS $$
BEGIN
delete from acs_object_context_index
where object_id = old.object_id;
return old;
END;
$$ LANGUAGE plpgsql;
create trigger acs_objects_context_id_del_tr before delete on acs_objects
for each row execute procedure acs_objects_context_id_del_tr ();
----------------------
-- ATTRIBUTE VALUES --
----------------------
......@@ -519,7 +507,7 @@ comment on table acs_attribute_values is '
';
create table acs_static_attr_values (
object_type varchar(100) not null
object_type varchar(1000) not null
constraint acs_static_a_v_obj_id_fk
references acs_object_types (object_type) on delete cascade,
attribute_id integer not null
......@@ -1082,7 +1070,7 @@ BEGIN
end if;
else
-- Specific attribute: table name/column need to be retreived
-- Specific attribute: table name/column need to be retrieved
if v_static = 'f' then
select
......@@ -1390,15 +1378,15 @@ BEGIN
-- N_GENERATIONS is how far ancestor_id is from object_id
-- Note that this function is only supposed to verify that the
-- index contains each ancestor for OBJECT_ID. It doesn''t
-- index contains each ancestor for OBJECT_ID. It doesn't
-- guarantee that there aren''t extraneous rows or that
-- OBJECT_ID''s children are contained in the index. That is
-- verified by seperate functions.
-- OBJECT_ID's children are contained in the index. That is
-- verified by separate functions.
result := 't';
-- Grab the context and security_inherit_p flag of the current
-- ancestor''s parent.
-- ancestor's parent.
select context_id, security_inherit_p
into check_object_ancestors__context_id,
check_object_ancestors__security_inherit_p
......@@ -1409,7 +1397,7 @@ BEGIN
if check_object_ancestors__context_id is null then
result := 't';
else
-- This can be a constraint, can''t it?
-- This can be a constraint, can't it?
PERFORM acs_log__error('acs_object.check_representation',
'Object 0 doesn''t have a null context_id');
result := 'f';
......@@ -1463,7 +1451,7 @@ BEGIN
-- N_GENERATIONS is how far the current DESCENDANT_ID is from
-- OBJECT_ID.
-- This function will verfy that each actualy descendant of
-- This function will verfy that each actually descendant of
-- OBJECT_ID has a row in the index table. It does not check that
-- there aren't extraneous rows or that the ancestors of OBJECT_ID
-- are maintained correctly.
......
This diff is collapsed.
......@@ -22,11 +22,11 @@ create table acs_rel_roles (
);
create table acs_rel_types (
rel_type varchar(100) not null
rel_type varchar(1000) not null
constraint acs_rel_types_rel_type_pk primary key
constraint acs_rel_types_rel_type_fk
references acs_object_types(object_type),
object_type_one varchar(100) not null
object_type_one varchar(1000) not null
constraint acs_rel_types_obj_type_1_fk
references acs_object_types (object_type),
role_one varchar(100) constraint acs_rel_types_role_one_fk
......@@ -37,7 +37,7 @@ create table acs_rel_types (
max_n_rels_one integer
constraint acs_rel_types_max_n_1_ck
check (max_n_rels_one >= 0),
object_type_two varchar(100) not null
object_type_two varchar(1000) not null
constraint acs_rel_types_obj_type_2_fk
references acs_object_types (object_type),
role_two varchar(100) constraint acs_rel_types_role_two_fk
......@@ -48,6 +48,8 @@ create table acs_rel_types (
max_n_rels_two integer
constraint acs_rel_types_max_n_2_ck
check (max_n_rels_two >= 0),
composable_p boolean
default 't' not null,
constraint acs_rel_types_n_rels_one_ck
check (min_n_rels_one <= max_n_rels_one),
constraint acs_rel_types_n_rels_two_ck
......@@ -59,7 +61,7 @@ create index acs_rel_types_role_one_idx on acs_rel_types (role_one);
create index acs_rel_types_objtypetwo_idx on acs_rel_types (object_type_two);
create index acs_rel_types_role_two_idx on acs_rel_types (role_two);
comment on table acs_rel_types is '
comment on table acs_rel_types is $$
Each row in <code>acs_rel_types</code> represents a type of
relationship between objects. For example, the following DML
statement:
......@@ -69,9 +71,9 @@ comment on table acs_rel_types is '
object_type_one, role_one, min_n_rels_one, max_n_rels_one,
object_type_two, role_two, min_n_rels_two, max_n_rels_two)
values
(''employment'',
''person'', ''employee'', 0, null,
''company'', ''employer'', 0, null)
('employment',
'person', 'employee', 0, null,
'company', 'employer', 0, null)
</pre></blockquote>
defines an "employment" relationship type that can be expressed in
in natural language as:
......@@ -79,7 +81,7 @@ comment on table acs_rel_types is '
A person may be the employee of zero or more companies, and a company
may be the employer of zero or more people.
</blockquote>
';
$$;
......@@ -197,11 +199,39 @@ $$ LANGUAGE plpgsql stable strict;
-- procedure create_type
-- added
-- procedure create_type
-- acs_rel_type__create_type /15 vs. /16 has
-- /15 has no "roles" (one and two), but "type_extension_table"
-- /16
-- pos 1-7: same as /15
-- pos 08: object_type_one (varchar)
-- pos 09: role_one (varchar)
-- pos 10: min_n_rels_one (integer)
-- pos 11: max_n_rels (integer)
-- pos 12: object_type_one (varchar)
-- pos 13: role_two (varchar)
-- pos 14: min_n_rels_two (integer)
-- pos 15: max_n_rels_two (integer)
-- pos 16: composable_p (boolean)
-- /15
-- pos 1-7: same as /15
-- pos 08: type_extension_table (varchar)
-- pos 09: object_type_one (varchar)
-- pos 10: min_n_rels_one (integer)
-- pos 11: max_n_rels (integer)
-- pos 12: object_type_two (varchar)
-- pos 13: min_n_rels_two (integer)
-- pos 14: max_n_rels_two (integer)
-- pos 15: composable_p (boolean)
select define_function_args('acs_rel_type__create_type','rel_type,pretty_name,pretty_plural,supertype;relationship,table_name,id_column,package_name,object_type_one,role_one;null,min_n_rels_one,max_n_rels_one,object_type_two,role_two;null,min_n_rels_two,max_n_rels_two,composable_p;t');
--
--
-- procedure acs_rel_type__create_type/16
--
CREATE OR REPLACE FUNCTION acs_rel_type__create_type(
create_type__rel_type varchar,
......@@ -218,7 +248,8 @@ CREATE OR REPLACE FUNCTION acs_rel_type__create_type(
create_type__object_type_two varchar,
create_type__role_two varchar, -- default null
create_type__min_n_rels_two integer,
create_type__max_n_rels_two integer
create_type__max_n_rels_two integer,
create_type__composable_p boolean default true
) RETURNS integer AS $$
DECLARE
......@@ -245,13 +276,15 @@ BEGIN
object_type_one, role_one,
min_n_rels_one, max_n_rels_one,
object_type_two, role_two,
min_n_rels_two, max_n_rels_two)
min_n_rels_two, max_n_rels_two,
composable_p)
values
(create_type__rel_type,
create_type__object_type_one, create_type__role_one,
create_type__min_n_rels_one, create_type__max_n_rels_one,
create_type__object_type_two, create_type__role_two,
create_type__min_n_rels_two, create_type__max_n_rels_two);
create_type__min_n_rels_two, create_type__max_n_rels_two,
create_type__composable_p);
return 0;
END;
......@@ -259,11 +292,10 @@ $$ LANGUAGE plpgsql;
-- procedure create_type
--
-- procedure acs_rel_type__create_type/14
-- procedure acs_rel_type__create_type/15
--
CREATE OR REPLACE FUNCTION acs_rel_type__create_type(
create_type__rel_type varchar,
......@@ -279,7 +311,8 @@ CREATE OR REPLACE FUNCTION acs_rel_type__create_type(
create_type__max_n_rels_one integer,
create_type__object_type_two varchar,
create_type__min_n_rels_two integer,
create_type__max_n_rels_two integer
create_type__max_n_rels_two integer,
create_type__composable_p boolean default true
) RETURNS integer AS $$
DECLARE
......@@ -308,13 +341,15 @@ BEGIN
object_type_one, role_one,
min_n_rels_one, max_n_rels_one,
object_type_two, role_two,
min_n_rels_two, max_n_rels_two)
min_n_rels_two, max_n_rels_two,
composable_p)
values
(create_type__rel_type,
create_type__object_type_one, create_type__role_one,
create_type__min_n_rels_one, create_type__max_n_rels_one,
create_type__object_type_two, create_type__role_two,
create_type__min_n_rels_two, create_type__max_n_rels_two);
create_type__min_n_rels_two, create_type__max_n_rels_two,
create_type__composable_p);
return 0;
END;
......@@ -522,8 +557,9 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
create trigger acs_rels_in_tr before insert or update on acs_rels
for each row execute procedure acs_rels_in_tr ();
create trigger acs_rels_in_tr before insert or update on acs_rels
for each row execute procedure acs_rels_in_tr ();
-- show errors
......@@ -553,12 +589,8 @@ for each row execute procedure acs_rels_in_tr ();
-- function new
-- old define_function_args('acs_rel__new','rel_id,rel_type,object_id_one,object_id_two,context_id,creation_user,creation_ip')
-- new
select define_function_args('acs_rel__new','rel_id;null,rel_type;relationship,object_id_one,object_id_two,context_id;null,creation_user;null,creation_ip;null');
--
-- procedure acs_rel__new/7
--
......
......@@ -46,54 +46,54 @@ create table apm_package_types (
not null
);
comment on table apm_package_types is '
comment on table apm_package_types is $$
This table holds additional knowledge level attributes for the
apm_package type and its subtypes.
';
$$;
comment on column apm_package_types.package_key is '
comment on column apm_package_types.package_key is $$
The package_key is what we call the package on this system.
';
$$;
comment on column apm_package_types.package_uri is '
comment on column apm_package_types.package_uri is $$
The package URI indicates where the package can be downloaded and
is a unique identifier for the package.
';
$$;
comment on column apm_package_types.spec_file_path is '
comment on column apm_package_types.spec_file_path is $$
The path to the package specification file.
';
$$;
comment on column apm_package_types.spec_file_mtime is '
comment on column apm_package_types.spec_file_mtime is $$
The last time a spec file was modified. This information is maintained in the
database so that if a user changes the specification file by editing the file
(as opposed to using the UI, the system can read the .info file and update
the information in the database appropriately.
';
$$;
comment on column apm_package_types.initial_install_p is '
comment on column apm_package_types.initial_install_p is $$
Indicates if the package should be installed during initial installation,
in other words whether or not this package is part of the OpenACS core.
';
$$;
comment on column apm_package_types.singleton_p is '
comment on column apm_package_types.singleton_p is $$
Indicates if the package can be used for subsites. If this is set to
''t'', the package can be enabled for any subsite. Otherwise, it is
't', the package can be enabled for any subsite. Otherwise, it is
restricted to the acs-admin/ subsite.
';
$$;
comment on column apm_package_types.implements_subsite_p is '
comment on column apm_package_types.implements_subsite_p is $$
If true, this package implements subsite semantics, typically by extending the
acs-subsite package. Used by the admin "mount subsite" UI, the request processor (for
setting ad_conn''s subsite_* attributes), etc.
';
setting ad_conn's subsite_* attributes), etc.
$$; -- '
comment on column apm_package_types.inherit_templates_p is '
comment on column apm_package_types.inherit_templates_p is $$
If true, inherit templates from packages this package extends. If false, only
templates in this package''s www subdirectory tree will be mapped to URLs by the
templates in this package's www subdirectory tree will be mapped to URLs by the
request processor.
';
$$; -- '
CREATE OR REPLACE FUNCTION inline_0 () RETURNS integer AS $$
BEGIN
......@@ -175,11 +175,11 @@ create table apm_packages (
create index apm_packages_package_key_idx on apm_packages (package_key);
-- This cant be added at table create time since acs_objects is created before apm_packages;
-- This can't be added at table create time since acs_objects is created before apm_packages;
alter table acs_objects add constraint acs_objects_package_id_fk foreign key (package_id) references apm_packages(package_id) on delete set null;
comment on table apm_packages is '
This table maintains the list of all package instances in the sytem.
This table maintains the list of all package instances in the system.
';
comment on column apm_packages.instance_name is '
......@@ -249,7 +249,7 @@ comment on table apm_package_versions is '
bboard-1.0.1, etc.
';
comment on column apm_package_versions.version_name is '
comment on column apm_package_versions.version_name is $$
A version number consists of:
1.A major version number.
2.Optionally, up to three minor version numbers.
......@@ -260,10 +260,10 @@ A version number consists of:
No letter at all, indicating a final release.
In addition, the letters d, a, and b may be followed by another integer, indicating a version within the release.
For those who like regular expressions:
version_number := integer (''.'' integer){0,3} ((''d''|''a''|''b'') integer?)?
version_number := integer ('.' integer){0,3} (('d'|'a'|'b') integer?)?
So the following is a valid progression for version numbers:
0.9d, 0.9d1, 0.9a1, 0.9b1, 0.9b2, 0.9, 1.0, 1.0.1, 1.1b1, 1.1
';
$$;
comment on column apm_package_versions.version_uri is '
This column should uniquely identify a package version. This URI should in practice be a URL at which this specific
......@@ -281,18 +281,18 @@ comment on column apm_package_versions.description_format is '
Must indicate whether the description is plain text or HTML.
';
comment on column apm_package_versions.description is '
comment on column apm_package_versions.description is $$
Type a one-paragraph description of your package. This is probably analogous
to the first paragraph in your package''s documentation. This is used to describe
to the first paragraph in your package's documentation. This is used to describe
the system to users considering installing it.
';
$$;
comment on column apm_package_versions.release_date is '
comment on column apm_package_versions.release_date is $$
This tracks when the package was released. Releasing a package means
freezing the code and files, creating an archive, and making the
package available for donwload. XXX (bquinn): I''m skeptical about the
package available for donwload. XXX (bquinn): I'm skeptical about the
usefulness of storing this information here.
';
$$;
comment on column apm_package_versions.vendor is '
If the package is being released by a company or some kind of organization,
......@@ -669,7 +669,7 @@ comment on column apm_package_callbacks.type is '
values are given by the Tcl proc apm_supported_callback_types.
';
-- Ths view faciliates accessing information about package versions by joining
-- Ths view facilitates accessing information about package versions by joining
-- the apm_package_types information and acs_object_types information (which is
-- invariant across versions) with the specific version information.
......
......@@ -32,12 +32,12 @@ drop function membership_rels_in_tr ();
-- procedure membership_rels_in_tr/0
--
CREATE OR REPLACE FUNCTION membership_rels_in_tr(
) RETURNS trigger AS $$
DECLARE
v_object_id_one acs_rels.object_id_one%TYPE;
v_object_id_two acs_rels.object_id_two%TYPE;
v_rel_type acs_rels.rel_type%TYPE;
v_composable_p acs_rel_types.composable_p%TYPE;
v_error text;
map record;
BEGIN
......@@ -48,9 +48,10 @@ BEGIN
raise EXCEPTION '-20000: %', v_error;
end if;
select object_id_one, object_id_two, rel_type
into v_object_id_one, v_object_id_two, v_rel_type
from acs_rels
select object_id_one, object_id_two, r.rel_type, composable_p
into v_object_id_one, v_object_id_two, v_rel_type, v_composable_p
from acs_rels r
join acs_rel_types t on (r.rel_type = t.rel_type)
where rel_id = new.rel_id;
-- Insert a row for me in the group_element_index.
......@@ -65,26 +66,29 @@ BEGIN
perform party_approved_member__add(v_object_id_one, v_object_id_two, new.rel_id, v_rel_type);
end if;
-- For all groups of which I am a component, insert a
-- row in the group_element_index.
for map in select distinct group_id
-- If this rel_type composable...
if v_composable_p = 't' then
-- For all groups of which I am a component, insert a
-- row in the group_element_index.
for map in select distinct group_id
from group_component_map
where component_id = v_object_id_one
loop
insert into group_element_index
(group_id, element_id, rel_id, container_id,
rel_type, ancestor_rel_type)
values
(map.group_id, v_object_id_two, new.rel_id, v_object_id_one,
v_rel_type, 'membership_rel');
loop
if new.member_state = 'approved' then
perform party_approved_member__add(map.group_id, v_object_id_two, new.rel_id, v_rel_type);
end if;
insert into group_element_index
(group_id, element_id, rel_id, container_id,
rel_type, ancestor_rel_type)
values
(map.group_id, v_object_id_two, new.rel_id, v_object_id_one,
v_rel_type, 'membership_rel');
end loop;
if new.member_state = 'approved' then
perform party_approved_member__add(map.group_id, v_object_id_two, new.rel_id, v_rel_type);
end if;
end loop;
end if;
return new;
END;
......@@ -214,15 +218,17 @@ BEGIN
and element_id = m.member_id
and rel_id = m.rel_id);
-- Make my elements be elements of my new composite group
-- Make my composable elements be elements of my new composite group
insert into group_element_index
(group_id, element_id, rel_id, container_id,
rel_type, ancestor_rel_type)
select distinct
v_object_id_one, element_id, rel_id, container_id,
rel_type, ancestor_rel_type
m.rel_type, ancestor_rel_type
from group_element_map m
join acs_rel_types t on (m.rel_type = t.rel_type)
where group_id = v_object_id_two
and t.composable_p = 't'
and not exists (select 1
from group_element_map
where group_id = v_object_id_one
......@@ -247,25 +253,29 @@ BEGIN
-- Add to party_approved_member_map
perform party_approved_member__add(map.group_id, member_id, rel_id, rel_type)
perform party_approved_member__add(map.group_id, member_id, rel_id, m.rel_type)
from group_approved_member_map m
join acs_rel_types t on (m.rel_type = t.rel_type)
where group_id = v_object_id_two
and t.composable_p = 't'
and not exists (select 1
from group_element_map
where group_id = map.group_id
and element_id = m.member_id
and rel_id = m.rel_id);
-- Add rows for my elements
-- Add rows for my composable elements
insert into group_element_index
(group_id, element_id, rel_id, container_id,
rel_type, ancestor_rel_type)
select distinct
map.group_id, element_id, rel_id, container_id,
rel_type, ancestor_rel_type
m.rel_type, ancestor_rel_type
from group_element_map m
join acs_rel_types t on (m.rel_type = t.rel_type)
where group_id = v_object_id_two
and t.composable_p = 't'
and not exists (select 1
from group_element_map
where group_id = map.group_id
......@@ -396,13 +406,8 @@ for each row execute procedure composition_rels_del_tr ();
-- create or replace package body composition_rel
-- function new
-- old define_function_args('composition_rel__new','rel_id,rel_type;composition_rel,object_id_one,object_id_two,creation_user,creation_ip')
-- new
select define_function_args('composition_rel__new','rel_id;null,rel_type;composition_rel,object_id_one,object_id_two,creation_user;null,creation_ip;null');
--
-- procedure composition_rel__new/6
--
......@@ -418,6 +423,7 @@ CREATE OR REPLACE FUNCTION composition_rel__new(
DECLARE
v_rel_id integer;
BEGIN
raise NOTICE 'composition_rel__new one % two %', object_id_one, object_id_two;
v_rel_id := acs_rel__new (
new__rel_id,
rel_type,
......@@ -1191,7 +1197,6 @@ $$ LANGUAGE plpgsql stable strict;
select define_function_args('acs_group__member_p','party_id,group_id,cascade_membership');
--
......@@ -1204,19 +1209,24 @@ CREATE OR REPLACE FUNCTION acs_group__member_p(
) RETURNS boolean AS $$
DECLARE
BEGIN
if p_cascade_membership then
if p_cascade_membership then
--
-- Direct and indirect memberships
--
return count(*) > 0
from group_member_map
where group_id = p_group_id and
member_id = p_party_id;
where group_id = p_group_id
and member_id = p_party_id;
else
--
-- Only direct memberships
--
return count(*) > 0
from acs_rels rels, all_object_party_privilege_map perm
where perm.object_id = rels.rel_id
and perm.privilege = 'read'
and rels.rel_type = 'membership_rel'
and rels.object_id_one = p_group_id
and rels.object_id_two = p_party_id;
from acs_rels rels
where rels.rel_type = 'membership_rel'
and rels.object_id_one = p_group_id
and rels.object_id_two = p_party_id
and acs_permission.permission_p(rels.rel_id, p_party_id, 'read');
end if;
END;
$$ LANGUAGE plpgsql stable;
......@@ -1283,19 +1293,10 @@ $$ LANGUAGE plpgsql;
-- show errors
-- create or replace package body admin_rel
-- function new
-- old define_function_args('admin_rel__new','rel_id,rel_type;admin_rel,object_id_one,object_id_two,member_state;approved,creation_user,creation_ip')
-- new
select define_function_args('admin_rel__new','rel_id;null,rel_type;admin_rel,object_id_one,object_id_two,member_state;approved,creation_user;null,creation_ip;null');
--
-- procedure admin_rel__new/7
--
......@@ -1332,9 +1333,6 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
-- function new
--
-- procedure admin_rel__new/2
--
......@@ -1359,10 +1357,8 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
-- procedure delete
select define_function_args('admin_rel__delete','rel_id');
--
......
......@@ -108,7 +108,8 @@ BEGIN
'group',
'component',
0,
null
null,
't'
);
......@@ -132,7 +133,8 @@ BEGIN
'person', -- object_type_two
'member', -- role_two
0, -- min_n_rels_two
null -- max_n_rels_two
null, -- max_n_rels_two
't'
);
--
......@@ -149,13 +151,14 @@ BEGIN
'rel_id', -- id_column
'admin_rel', -- package_name
'group', -- object_type_one
null, -- role_one
0, -- min_n_rels_one
null, -- max_n_rels_one
null, -- role_one
0, -- min_n_rels_one
null, -- max_n_rels_one
'person', -- object_type_two
'admin', -- role_two
0, -- min_n_rels_two
null -- max_n_rels_two
0, -- min_n_rels_two
null, -- max_n_rels_two
false -- composable_p
);
return 0;
......@@ -170,7 +173,7 @@ drop function inline_0 ();
-- show errors
create table group_types (
group_type varchar(400) not null
group_type varchar(1000) not null
constraint group_types_group_type_pk primary key
constraint group_types_group_type_fk
references acs_object_types (object_type),
......@@ -204,11 +207,11 @@ create table groups (
create table group_type_rels (
group_rel_type_id integer constraint gtr_group_rel_type_id_pk primary key,
rel_type varchar(100) not null
rel_type varchar(1000) not null
constraint group_type_rels_rel_type_fk
references acs_rel_types (rel_type)
on delete cascade,
group_type varchar(100) not null
group_type varchar(1000) not null
constraint group_type_rels_group_type_fk
references acs_object_types (object_type)
on delete cascade,
......@@ -228,7 +231,7 @@ comment on table group_type_rels is '
create table group_rels (
group_rel_id integer constraint group_rels_group_rel_id_pk primary key,
rel_type varchar(100) not null
rel_type varchar(1000) not null
constraint group_rels_rel_type_fk
references acs_rel_types (rel_type)
on delete cascade,
......@@ -295,7 +298,7 @@ create table group_element_index (
constraint group_element_index_cont_id_fk
references groups (group_id)
on delete cascade,
rel_type varchar(100) not null
rel_type varchar(1000) not null
constraint group_elem_index_rel_type_fk
references acs_rel_types (rel_type)
on delete cascade,
......@@ -317,13 +320,13 @@ create index group_elem_idx_rel_type_idx on group_element_index (rel_type);
-- create index group_elem_idx_container_idx on group_element_index (container_id);
comment on table group_element_index is '
comment on table group_element_index is $$
This table is for internal use by the parties system. It as an auxiliary
table, a denormalization of data, that is used to improve performance.
Do not query on this table or insert into it. Query on group_element_map
instead. And insert by using the API''s for membership_rel, composition_rel,
instead. And insert by using the API's for membership_rel, composition_rel,
or some sub-type of those relationship types.
';
$$; -- ease life of syntax high-lighter '
-----------
......@@ -355,7 +358,7 @@ create view group_distinct_member_map
as select distinct group_id, member_id
from group_approved_member_map;
-- some more views, like party_memeber_map and party_approved_member_map,
-- some more views, like party_member_map and party_approved_member_map,
-- are created in rel-segments-create.sql
-- Just in case someone is still querying the group_component_index and
......@@ -475,7 +478,7 @@ for each row execute procedure composition_rels_in_tr();
---------------------------------------------
-- POPULATE DATA FOR PERMISSABLE REL TYPES --
-- POPULATE DATA FOR PERMISSIBLE REL TYPES --
---------------------------------------------
-- define standard types for groups of type 'group'
......
create view dual as select now() as sysdate;
-- used to support anonymous plsql blocks in the db_plsql function call in tcl.
create sequence t_anon_func_seq;
create view anon_func_seq as
select nextval('t_anon_func_seq') as nextval;
create sequence anon_func_seq;
--
-- procedure instr/4
......@@ -253,58 +249,35 @@ $$ LANGUAGE plpgsql immutable strict;
--
-- procedure get_func_definition/2
--
CREATE OR REPLACE FUNCTION get_func_definition(
fname varchar,
args oidvector
) RETURNS text AS $$
) RETURNS text AS $PROC$
DECLARE
nargs integer default 0;
v_pos integer;
v_funcdef text default '';
v_args varchar;
v_one_arg varchar;
v_one_type varchar;
v_nargs integer;
v_src text;
v_rettype varchar;
BEGIN
select proargtypes, pronargs, number_src(prosrc),
select pg_get_function_arguments(oid), pronargs, prosrc, -- was number_src(prosrc)
(select typname from pg_type where oid = p.prorettype::integer)
into v_args, v_nargs, v_src, v_rettype
from pg_proc p
where proname = fname::name
and proargtypes = args;
v_funcdef := v_funcdef || '
create or replace function ' || fname || '(';
v_pos := position(' ' in v_args);
while nargs < v_nargs loop
nargs := nargs + 1;
if nargs = v_nargs then
v_one_arg := v_args;
v_args := '';
else
v_one_arg := substr(v_args, 1, v_pos - 1);
v_args := substr(v_args, v_pos + 1);
v_pos := position(' ' in v_args);
end if;
select case when nargs = 1
then typname
else ',' || typname
end into v_one_type
from pg_type
where oid = v_one_arg::integer;
v_funcdef := v_funcdef || v_one_type;
end loop;
v_funcdef := v_funcdef || ') returns ' || v_rettype || E' as ''\n' || v_src || ''' language ''plpgsql'';';
v_funcdef :=
E'--\n-- ' || fname || '/' || v_nargs || E'\n--'
|| E'\ncreate or replace function ' || fname || E'(\n '
|| replace(v_args, ', ', E',\n ')
|| E'\n) returns ' || v_rettype
|| E' as $$\n' || v_src || '$$ language plpgsql;';
return v_funcdef;
END;
$$ LANGUAGE plpgsql stable strict;
$PROC$ LANGUAGE plpgsql stable strict;
--
......@@ -798,9 +771,6 @@ $$ language 'sql' immutable strict;
-- that acs_objects will become HUGE on real systems the resulting sequential scan would cripple
-- performance.
-- WARNING: subselects in where clauses that call this function and join on an outer table appear
-- to reliably kill PG 7.1.2, at least if "exists" is involved. PG 7.2 doesn''t die on my test
-- case, so it appears to have been fixed.
create or replace function tree_ancestor_keys(varbit) returns setof varbit as $$
select tree_ancestor_keys($1, 1)
......@@ -977,7 +947,7 @@ select define_function_args('trigger_type','tgtype');
-- PG version checking helper
-- vguerra@wu.ac.at
-- This helper function indicates wether the current version of PG
-- This helper function indicates whether the current version of PG
-- one runs on is greater than, less than or equal to a given version,
-- returning 1 , -1 or 0 correspondingly.
......@@ -1001,8 +971,11 @@ BEGIN
ret_val = 0;
user_pg_version := string_to_array(trim(p__version),'.')::int[];
select string_to_array(setting, '.')::int[] into pg_version from pg_settings where name = 'server_version';
-- select string_to_array(setting, '.')::int[] into pg_version from pg_settings where name = 'server_version';
-- the following version does not barf on beta-versions etc.
select string_to_array(setting::int/10000 || '.' || (setting::int%10000)/100 || '.' || (setting::int%100), '.')::int[] into pg_version
from pg_settings where name = 'server_version_num';
for index in array_length(user_pg_version, 1) + 1..array_length(pg_version, 1) loop
user_pg_version[index] := 0;
......
......@@ -170,21 +170,25 @@ create table party_approved_member_map (
constraint party_member_member_fk
references parties
on delete cascade,
tag integer
constraint party_member_tag_nn
not null,
originating_rel_id integer
constraint party_member_rel_id_fk
references acs_rels
on delete cascade,
constraint party_approved_member_map_pk
primary key (party_id, member_id, tag)
primary key (party_id, member_id, originating_rel_id)
);
-- Need this to speed referential integrity
create index party_member_member_idx on party_approved_member_map(member_id);
create index party_member_party_idx on party_approved_member_map(party_id);
create index party_member_originating_idx on party_approved_member_map(originating_rel_id);
-- Helper functions to maintain the materialized party_approved_member_map.
select define_function_args('party_approved_member__add_one','party_id,member_id,rel_id');
--
......@@ -199,7 +203,7 @@ DECLARE
BEGIN
insert into party_approved_member_map
(party_id, member_id, tag)
(party_id, member_id, originating_rel_id)
values
(p_party_id, p_member_id, p_rel_id);
......@@ -210,7 +214,6 @@ $$ LANGUAGE plpgsql;
select define_function_args('party_approved_member__add','party_id,member_id,rel_id,rel_type');
--
......@@ -248,7 +251,6 @@ $$ LANGUAGE plpgsql;
select define_function_args('party_approved_member__remove_one','party_id,member_id,rel_id');
--
......@@ -265,7 +267,7 @@ BEGIN
delete from party_approved_member_map
where party_id = p_party_id
and member_id = p_member_id
and tag = p_rel_id;
and originating_rel_id = p_rel_id;
return 1;
......@@ -275,7 +277,6 @@ $$ LANGUAGE plpgsql;
select define_function_args('party_approved_member__remove','party_id,member_id,rel_id,rel_type');
--
......@@ -320,17 +321,17 @@ CREATE OR REPLACE FUNCTION parties_in_tr () RETURNS trigger AS $$
BEGIN
insert into party_approved_member_map
(party_id, member_id, tag)
(party_id, member_id, originating_rel_id)
values
(new.party_id, new.party_id, 0);
(new.party_id, new.party_id, -10);
return new;
END;
$$ LANGUAGE plpgsql;
create trigger parties_in_tr after insert on parties
for each row execute procedure parties_in_tr ();
create trigger parties_in_tr after insert on parties
for each row execute procedure parties_in_tr ();
CREATE OR REPLACE FUNCTION parties_del_tr () RETURNS trigger AS $$
BEGIN
......@@ -357,7 +358,7 @@ CREATE OR REPLACE FUNCTION rel_segments_in_tr () RETURNS trigger AS $$
BEGIN
insert into party_approved_member_map
(party_id, member_id, tag)
(party_id, member_id, originating_rel_id)
select new.segment_id, element_id, rel_id
from group_element_index
where group_id = new.group_id
......
......@@ -39,8 +39,6 @@ select inline_0 ();
drop function inline_0 ();
-- show errors
-- This table allows urls to be mapped to a node_ids.
create table site_nodes (
......@@ -50,7 +48,7 @@ create table site_nodes (
primary key,
parent_id integer constraint site_nodes_parent_id_fk
references site_nodes (node_id),
name varchar(100)
name text
constraint site_nodes_name_ck
check (name not like '%/%'),
constraint site_nodes_un
......@@ -59,7 +57,7 @@ create table site_nodes (
directory_p boolean not null,
-- Should urls that are logical children of this node be
-- mapped to this node?
pattern_p boolean default 'f' not null,
pattern_p boolean default false not null,
object_id integer constraint site_nodes_object_id_fk
references acs_objects (object_id),
tree_sortkey varbit
......@@ -354,22 +352,17 @@ END;
$$ LANGUAGE plpgsql;
-- function node_id
-- added
select define_function_args('site_node__node_id','url,parent_id;null');
--
-- procedure site_node__node_id/2
--
CREATE OR REPLACE FUNCTION site_node__node_id(
node_id__url varchar,
node_id__parent_id integer -- default null
p_url varchar,
p_parent_id integer default null
) RETURNS integer AS $$
DECLARE
v_pos integer;
v_pos integer;
v_first site_nodes.name%TYPE;
v_rest text;
v_node_id integer;
......@@ -378,34 +371,45 @@ DECLARE
v_directory_p site_nodes.directory_p%TYPE;
v_trailing_slash_p boolean;
BEGIN
v_url := node_id__url;
v_url := p_url;
if substr(v_url, length(v_url), 1) = '/' then
-- It ends with a / so it must be a directory.
v_trailing_slash_p := 't';
--
-- The URL ends with a / so it must be a directory. Strip the
-- trailing slash.
--
v_trailing_slash_p := true;
v_url := substr(v_url, 1, length(v_url) - 1);
end if;
v_pos := 1;
while v_pos <= length(v_url) and substr(v_url, v_pos, 1) <> '/' loop
v_pos := v_pos + 1;
end loop;
--
-- Split the URL on the first "/" into v_first and v_rest.
--
select position('/' in v_url) into v_pos;
if v_pos = length(v_url) then
if v_pos = 0 then
--
-- No slash found
--
v_first := v_url;
v_rest := null;
else
--
-- Split URL
--
v_first := substr(v_url, 1, v_pos - 1);
v_rest := substr(v_url, v_pos + 1);
end if;
if node_id__parent_id is not null then
if p_parent_id is not null then
select node_id, directory_p into v_node_id, v_directory_p
from site_nodes
where parent_id = node_id__parent_id
where parent_id = p_parent_id
and name = v_first;
else
else
--
-- This is typically just the query on the (empty) top-node.
--
select node_id, directory_p into v_node_id, v_directory_p
from site_nodes
where parent_id is null
......@@ -413,29 +417,35 @@ BEGIN
end if;
if NOT FOUND then
return site_node__find_pattern(node_id__parent_id);
return site_node__find_pattern(p_parent_id);
end if;
--
-- v_first was found.
--
if v_rest is null then
if v_trailing_slash_p = 't' and v_directory_p = 'f' then
return site_node__find_pattern(node_id__parent_id);
--
-- We are at the end of the URL. If we have a trailing slash and
-- the site node is not a directory, return the result of
-- find_pattern(). Otherwise, return the found node_id
--
if v_trailing_slash_p is true and v_directory_p is false then
return site_node__find_pattern(p_parent_id);
else
return v_node_id;
end if;
else
--
-- Call the function recursively on the v_rest chunk
--
return site_node__node_id(v_rest, v_node_id);
end if;
END;
$$ LANGUAGE plpgsql;
-- function url
select define_function_args('site_node__url','node_id');
select define_function_args('site_node__url','node_id');
--
-- procedure site_node__url/1
--
......@@ -508,4 +518,3 @@ $inline_0$ LANGUAGE plpgsql;
select inline_0();
drop function inline_0();
-- show errors
......@@ -511,7 +511,7 @@ BEGIN
PERFORM rel_constraint__delete(side_one_constraint);
PERFORM rel_constraint__delete(side_two_constraint);
-- Remove the test memebership relations
-- Remove the test membership relations
for r in select * from blah_member_rels LOOP
PERFORM blah_member_rel__delete(r.rel_id);
end loop;
......
......@@ -16,7 +16,8 @@ BEGIN
'party',
'member',
0,
null
null,
't'
);
......@@ -35,7 +36,8 @@ BEGIN
'party',
'member',
0,
null
null,
't'
);
return null;
......
......@@ -365,7 +365,7 @@ BEGIN
PERFORM rel_segment__delete(seg_E_yippies);
PERFORM rel_segment__delete(rel_segment__get(F,'membership_rel'));
-- Remove the test memebership relations
-- Remove the test membership relations
for r in select * from blah_member_rels LOOP
PERFORM blah_member_rel__delete(r.rel_id);
end loop;
......
......@@ -373,7 +373,7 @@ begin
end if;
else
-- Specific attribute: table name/column need to be retreived
-- Specific attribute: table name/column need to be retrieved
if v_static = ''f'' then
select
......
......@@ -77,7 +77,7 @@ begin
-- Add the appropriate column to the table
-- We can only create the table column if
-- 1. the attribute is declared type_specific (generic storage uses an auxillary table)
-- 1. the attribute is declared type_specific (generic storage uses an auxiliary table)
-- 2. the attribute is not declared static
-- 3. it does not already exist in the table
......
......@@ -387,7 +387,7 @@ begin
-- Add the appropriate column to the table
-- We can only create the table column if
-- 1. the attribute is declared type_specific (generic storage uses an auxillary table)
-- 1. the attribute is declared type_specific (generic storage uses an auxiliary table)
-- 2. the attribute is not declared static
-- 3. it does not already exist in the table
......
ALTER TABLE acs_objects drop column tree_sortkey cascade;
ALTER TABLE acs_objects drop column max_child_sortkey cascade;
DROP TRIGGER acs_objects_insert_tr on acs_objects;
DROP TRIGGER acs_objects_update_tr on acs_objects;
ALTER TABLE acs_objects drop column IF EXISTS tree_sortkey cascade;
ALTER TABLE acs_objects drop column IF EXISTS max_child_sortkey cascade;
DROP TRIGGER IF EXISTS acs_objects_insert_tr on acs_objects;
DROP TRIGGER IF EXISTS acs_objects_update_tr on acs_objects;
--
-- procedure content_type__refresh_view/1
......@@ -126,7 +125,7 @@ $$ LANGUAGE plpgsql;
-- (sometimes implicitely, e.g. via acs_objects.*) the
-- tree_sortkey. We perform this operation here (since the views were
-- dropped by this upgrade script) but as well in update scripts for
-- the relevant packages refering explicitly to the tree_sortkey
-- the relevant packages referring explicitly to the tree_sortkey
-- fields.
--
......@@ -228,14 +227,14 @@ where o.object_id = pa.party_id
-- fraber 160104: Disable execution. Execute as part of acs-content-repository upgrade.
--
SELECT t2.object_type, content_type__refresh_view(t2.object_type)
from acs_object_types t1, acs_object_types t2
where t2.tree_sortkey between t1.tree_sortkey and
tree_right(t1.tree_sortkey) and t1.object_type = 'content_revision';
--
-- we have to recreate fs_urls_full, when file-storage is in use,
-- since the view exports acs_objects.*
......@@ -280,13 +279,17 @@ create function inline_0()
returns integer as $inline_0$
declare success integer;
begin
--
-- We know we have to update the view when we have one of the base tables.
--
select 1 from pg_class into success where relname = 'download_repository';
IF found THEN
-- If the upgrade script is run multiple times, then
-- "ALTER TABLE acs_objects drop column ..."
-- might not have dropped the view. So we do this manually.
select 1 from pg_class into success where relname = 'download_repository_obj';
IF found THEN
drop view download_repository_obj;
......@@ -341,6 +344,6 @@ drop function inline_0();
-- drop trigger acs_objects_insert_tr on acs_objects;
-- drop trigger acs_objects_update_tr on acs_objects;
drop function acs_objects_get_tree_sortkey(integer);
drop function acs_objects_insert_tr();
drop function acs_objects_update_tr();
drop function IF EXISTS acs_objects_get_tree_sortkey(integer);
drop function IF EXISTS acs_objects_insert_tr();
drop function IF EXISTS acs_objects_update_tr();
......@@ -7,18 +7,20 @@
--
-- procedure acs_permission__grant_permission/3
--
DROP FUNCTION acs_permission__grant_permission(integer, integer, varchar);
CREATE OR REPLACE FUNCTION acs_permission__grant_permission(
grant_permission__object_id integer,
grant_permission__grantee_id integer,
grant_permission__privilege varchar
p_object_id integer,
p_grantee_id integer,
p_privilege varchar
) RETURNS integer AS $$
DECLARE
BEGIN
insert into acs_permissions
(object_id, grantee_id, privilege)
values
(grant_permission__object_id, grant_permission__grantee_id,
grant_permission__privilege);
(p_object_id, p_grantee_id,
p_privilege);
return 0;
EXCEPTION
......@@ -31,17 +33,19 @@ $$ LANGUAGE plpgsql;
--
-- procedure acs_permission__revoke_permission/3
--
DROP FUNCTION acs_permission__revoke_permission(integer, integer, varchar);
CREATE OR REPLACE FUNCTION acs_permission__revoke_permission(
revoke_permission__object_id integer,
revoke_permission__grantee_id integer,
revoke_permission__privilege varchar
p_object_id integer,
p_grantee_id integer,
p_privilege varchar
) RETURNS integer AS $$
DECLARE
BEGIN
delete from acs_permissions
where object_id = revoke_permission__object_id
and grantee_id = revoke_permission__grantee_id
and privilege = revoke_permission__privilege;
where object_id = p_object_id
and grantee_id = p_grantee_id
and privilege = p_privilege;
return 0;
END;
......
......@@ -21,7 +21,7 @@ CREATE OR REPLACE FUNCTION util__multiple_nextval(
v_count integer
) RETURNS varchar AS $$
DECLARE
a_sequence_values text default '';
a_sequence_values text default '';
v_rec record;
BEGIN
for counter in 1..v_count loop
......@@ -33,7 +33,7 @@ BEGIN
end loop;
return substr(a_sequence_values, 2);
END;
$$ LANGUAGE plpgsql;
......@@ -53,9 +53,9 @@ BEGIN
IF true_or_false is null THEN
return null;
ELSE IF true_or_false = 'f' THEN
return 't';
ELSE
return 'f';
return 't';
ELSE
return 'f';
END IF; END IF;
END;
$$ LANGUAGE plpgsql immutable strict;
......@@ -73,8 +73,8 @@ CREATE OR REPLACE FUNCTION util__table_exists(
DECLARE
BEGIN
return exists (
select 1 from pg_class
where relname = name
select 1 from pg_class
where relname = name
and pg_table_is_visible(oid));
END;
$$ LANGUAGE plpgsql;
......@@ -94,7 +94,7 @@ DECLARE
BEGIN
return exists (
select 1 from information_schema.columns c
where c.table_name = t_name
where c.table_name = t_name
and c.column_name = c_name);
END;
$$ LANGUAGE plpgsql;
......@@ -134,5 +134,168 @@ END;
$$ LANGUAGE plpgsql;
-- added
select define_function_args('util__foreign_key_exists','table,column,reftable,refcolumn');
--
-- procedure util__foreign_key_exists/4
--
CREATE OR REPLACE FUNCTION util__foreign_key_exists(
p_table text,
p_column text,
p_reftable text,
p_refcolumn text
) RETURNS boolean AS $$
DECLARE
BEGIN
return exists (
select 1 from
information_schema.table_constraints AS tc,
information_schema.key_column_usage AS kcu,
information_schema.constraint_column_usage AS ccu
where tc.constraint_name = kcu.constraint_name
and tc.constraint_catalog = kcu.constraint_catalog
and tc.constraint_schema = kcu.constraint_schema
and tc.table_catalog = kcu.table_catalog
and tc.table_schema = kcu.table_schema
and ccu.constraint_name = tc.constraint_name
and ccu.constraint_catalog = kcu.constraint_catalog
and ccu.constraint_schema = kcu.constraint_schema
and ccu.table_catalog = kcu.table_catalog
and ccu.table_schema = kcu.table_schema
and tc.constraint_type = 'FOREIGN KEY'
and tc.table_name = p_table
and kcu.column_name = p_column
and ccu.table_name = p_reftable
and ccu.column_name = p_refcolumn);
END;
$$ LANGUAGE plpgsql;
-- added
select define_function_args('util__unique_exists','table,column,single_p;true');
--
-- procedure util__unique_exists/3
--
CREATE OR REPLACE FUNCTION util__unique_exists(
p_table text,
p_column text,
p_single_p boolean default true
) RETURNS boolean AS $$
DECLARE
BEGIN
return exists (select 1
from
information_schema.table_constraints AS tc,
information_schema.key_column_usage AS kcu
where tc.constraint_name = kcu.constraint_name
and tc.constraint_catalog = kcu.constraint_catalog
and tc.constraint_schema = kcu.constraint_schema
and tc.table_catalog = kcu.table_catalog
and tc.table_schema = kcu.table_schema
and tc.constraint_type = 'UNIQUE'
and tc.table_name = p_table
and kcu.column_name = p_column
and (not p_single_p or (
-- this to ensure the constraint involves only one
-- column
select count(*) from information_schema.key_column_usage
where constraint_name = kcu.constraint_name
and constraint_catalog = kcu.constraint_catalog
and constraint_schema = kcu.constraint_schema) = 1));
END;
$$ LANGUAGE plpgsql;
-- added
select define_function_args('util__primary_key_exists','table,column,single_p;true');
--
-- procedure util__unique_exists/3
--
CREATE OR REPLACE FUNCTION util__primary_key_exists(
p_table text,
p_column text,
p_single_p boolean default true
) RETURNS boolean AS $$
DECLARE
BEGIN
return exists (select 1
from
information_schema.table_constraints AS tc,
information_schema.key_column_usage AS kcu
where tc.constraint_name = kcu.constraint_name
and tc.constraint_catalog = kcu.constraint_catalog
and tc.constraint_schema = kcu.constraint_schema
and tc.table_catalog = kcu.table_catalog
and tc.table_schema = kcu.table_schema
and tc.constraint_type = 'PRIMARY KEY'
and tc.table_name = p_table
and kcu.column_name = p_column
and (not p_single_p or (
-- this to ensure the constraint involves only one
-- column
select count(*) from information_schema.key_column_usage
where constraint_name = kcu.constraint_name
and constraint_catalog = kcu.constraint_catalog
and constraint_schema = kcu.constraint_schema) = 1));
END;
$$ LANGUAGE plpgsql;
-- added
select define_function_args('util__not_null_exists','table,column');
--
-- procedure util__not_null_exists/2
--
CREATE OR REPLACE FUNCTION util__not_null_exists(
p_table text,
p_column text
) RETURNS boolean AS $$
DECLARE
BEGIN
return (
coalesce((
select is_nullable = 'NO'
from information_schema.columns
where table_name = p_table
and column_name = p_column), false));
END;
$$ LANGUAGE plpgsql;
-- added
select define_function_args('util__get_default','table,column');
--
-- procedure util__get_default/2
--
CREATE OR REPLACE FUNCTION util__get_default(
p_table text,
p_column text
) RETURNS information_schema.columns.column_default%TYPE AS $$
DECLARE
BEGIN
return (
select column_default
from information_schema.columns
where table_name = p_table
and column_name = p_column);
END;
$$ LANGUAGE plpgsql;
-- added
select define_function_args('util__get_primary_keys','table');
--
-- procedure util__get_primary_keys/1
--
CREATE OR REPLACE FUNCTION util__get_primary_keys(
p_table text
) RETURNS SETOF pg_attribute.attname%TYPE AS $$
SELECT a.attname
FROM pg_index i
JOIN pg_attribute a ON a.attrelid = i.indrelid
AND a.attnum = ANY(i.indkey)
WHERE i.indrelid = p_table::regclass
AND i.indisprimary;
$$ LANGUAGE sql;
......@@ -328,7 +328,7 @@ BEGIN
PERFORM rel_constraint__delete(side_one_constraint);
PERFORM rel_constraint__delete(side_two_constraint);
-- Remove the test memebership relations
-- Remove the test membership relations
for r in select * from blah_member_rels LOOP
PERFORM blah_member_rel__delete(r.rel_id);
end loop;
......
......@@ -12,11 +12,12 @@ BEGIN
'group',
null,
0,
null,
null::integer,
'party',
'member',
0,
null
null::integer,
'f'
);
......@@ -31,11 +32,12 @@ BEGIN
'group',
null,
0,
null,
null::integer,
'party',
'member',
0,
null
null::integer,
'f'
);
return null;
......
......@@ -355,7 +355,7 @@ BEGIN
PERFORM rel_segment__delete(seg_E_yippes);
PERFORM rel_segment__delete(rel_segment__get(F,'membership_rel'));
-- Remove the test memebership relations
-- Remove the test membership relations
for r in select * from blah_member_rels LOOP
PERFORM blah_member_rel__delete(r.rel_id);
end loop;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment