From: Chris W. <ch...@cw...> - 2003-11-25 03:21:13
|
Vsevolod (Simon) Ilyushchenko wrote: > Is there an easy and supported way of using different security tables > for different classes? (That is, without changing SPOPS code.) > > I realize that the table is referenced in the security class's config > file (like 'spops_security' in My::Security), but the only way to do it > now is to have a different security class for each data class. But I > would like to pass a parameter to _base_config() in the security class > to tell it which table to use. I can't do it now, though, because my > code only return the security class name and never explicitly constructs > it. The SPOPS model is one class == one table, so the general answer is no. It would probably be best to just have SPOPS create a separate class for every table you want to access. (BTW, why do you want to do this?) Something else you could do: each of your SPOPS classes could override 'global_security_object_class()' and have each call set the table name in the one security object class. This is very tricky and potentially bug ridden, but it might look like: # 'My::SecurityObject' is your application's security class # 'my_table' is the table you want to use for this class sub global_security_object_class { my ( $item ) = @_; My::SecurityObject->CONFIG->{table_name} = 'my_table'; return 'My::SecurityObject'; } You could do this programmatically in a superclass as well, mapping your application class to security table name in a hash and using that rather than hardcoding it per app class. Hope this makes sense, Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |