Forum OpenACS Development: Response to Group definitions and use

Collapse
Posted by Nikolay Blyumberg on
Hi Andrew, thank you for your post, it has a lot of useful information. What I was trying actually succeeded to some extent. It was creating special group types like Manager and Supervisor, however, it was not telling ACS to create a group of that type. So if I went to the user interface and made them manually it worked. My code for doing it is below, but I will modify it once I understand your way of doing it a bit better.

One of the questions I have about your delete stuff is: Does it actually remove the user from the system? And does it keep the data created by that user intact? One of my current problems is that when I try to "delete" a user in OpenACS it simply marks them as "inactive" and hides them but they can be "un-deleted". So if a different person gets the same e-mail address I can't add them to the system.

My code for creating user types:

--create priviledged users here
--first create the manager

declare
	v_group_id	integer;
	default_context	acs_objects.object_id%TYPE;
begin
	default_context := acs.magic_object_id('default_context');
	select count(group_id) into v_group_id
	from groups


	where group_name='Manager';

	if v_group_id = 0 then
		v_group_id :=acs_group.new (group_name => 'Manager');
	else
		select group_id into v_group_id from groups where group_name='Manager';
	end if;

	acs_privilege.create_privilege ( 'manager' );
	acs_privilege.add_child( 'manager' );

	acs_permission.grant_permission( default_context, v_group_id, 'manager');
end;
/
show errors
And a supervisor which is identical to above but with 'Supervisor' instead of 'Manager'