--
--  Copyright (C) 2001, 2002 OpenForce, Inc.
--
--  This file is part of dotLRN.
--
--  dotLRN is free software; you can redistribute it and/or modify it under the
--  terms of the GNU General Public License as published by the Free Software
--  Foundation; either version 2 of the License, or (at your option) any later
--  version.
--
--  dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
--  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
--  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
--  details.
--

--
-- Sanitize the User Profile package
--
-- @author <a href="mailto:yon@openforce.net">yon@openforce.net</a>
-- @version $Id: users-sanitize.sql,v 1.2 2002/05/30 22:04:58 yon Exp $
--

declare
    v_segment_id                        integer;
    v_group_id                          integer;
begin

    select segment_id, group_id
    into v_segment_id, v_group_id
    from rel_segments
    where rel_type = 'dotlrn_user_profile_rel';

    delete
    from acs_permissions
    where grantee_id = v_segment_id;

    rel_segment.delete(
        segment_id => v_segment_id
    );

    delete
    from acs_permissions
    where grantee_id = v_group_id;

    profiled_group.delete(
        group_id => v_group_id
    );

    acs_rel_type.drop_type(
        rel_type => 'dotlrn_user_profile_rel',
        cascade_p => 't'
    );

end;
/
show errors
