Discussion:
[code cleaning] Missing public function get_subs in class.locations.inc.php
Maât
2008-10-25 18:47:23 UTC
Permalink
Hi all,

I'm still fighting bugs to move microstep by microstep to see .18 out
before i'm 120 years old :)

litle bit of progress today : i have a nearly installing phpgroupware
(well install does not die any more and it goes from the beginning to
the end, i can log in but there are no app available at all : just
about, home and logout)

i'm splitting the changes i made into small patches to avoid the giant
commit effect with many different things inside : each commit will
address a specific issue :

that will make patch review easier (and also make reverts easier in case
i made a mistake)

Among the issues, i found that get_subs() of class.locations.inc.php is
called from class.acl.inc.php but does not exist... with an empty method
i could prevent phpgw from crashing but i guess this method is supposed
to do something

Can someone help me either giving me the code of this method or
explaining what it is supposed to do ?

cheers,
maat (micro bug chaser)
Sigurd Nes
2008-10-26 07:03:36 UTC
Permalink
Post by Maât
Hi all,
I'm still fighting bugs to move microstep by microstep to see .18 out
before i'm 120 years old :)
litle bit of progress today : i have a nearly installing phpgroupware
(well install does not die any more and it goes from the beginning to
the end, i can log in but there are no app available at all : just
about, home and logout)
i'm splitting the changes i made into small patches to avoid the giant
commit effect with many different things inside : each commit will
that will make patch review easier (and also make reverts easier in case
i made a mistake)
Among the issues, i found that get_subs() of class.locations.inc.php is
called from class.acl.inc.php but does not exist... with an empty method
i could prevent phpgw from crashing but i guess this method is supposed
to do something
Can someone help me either giving me the code of this method or
explaining what it is supposed to do ?
cheers,
maat (micro bug chaser)
Hi maat,

it is supposed to get a list of sub-locations for a given location.

have a look at the table phpgw_locations - the field 'name' contains information
on the sub-locations as they are organised as:

name descr
. Top
.sub1 First submodule
.sub2 Second submodule
.sub1.sub1 First sub-sub at first sub

Regards

Sigurd
Maât
2008-10-26 10:45:27 UTC
Permalink
Post by Sigurd Nes
Post by Maât
Hi all,
I'm still fighting bugs to move microstep by microstep to see .18 out
before i'm 120 years old :)
litle bit of progress today : i have a nearly installing phpgroupware
(well install does not die any more and it goes from the beginning to
the end, i can log in but there are no app available at all : just
about, home and logout)
i'm splitting the changes i made into small patches to avoid the giant
commit effect with many different things inside : each commit will
that will make patch review easier (and also make reverts easier in case
i made a mistake)
Among the issues, i found that get_subs() of class.locations.inc.php is
called from class.acl.inc.php but does not exist... with an empty method
i could prevent phpgw from crashing but i guess this method is supposed
to do something
Can someone help me either giving me the code of this method or
explaining what it is supposed to do ?
cheers,
maat (micro bug chaser)
Hi maat,
it is supposed to get a list of sub-locations for a given location.
have a look at the table phpgw_locations - the field 'name' contains information
name descr
. Top
.sub1 First submodule
.sub2 Second submodule
.sub1.sub1 First sub-sub at first sub
Regards
Sigurd
so if i understand well :

( i put the sql definition of location table in footer to help )

the name field uses a dns approach to define locations and sub locations

then for a given app the sub locations for .location1 will be :

.location1.sublocation1
.location1.sublocation2
.location1.sublocation3

the remaining question is :

should this include sub-sub-locations ?

for example :

.location1.sublocation3.sussublocation1
.location1.sublocation3.sussublocation2
.location1.sublocation3.sussublocation3

iow :
-- should i request all name fields beginning with ".location1." (which
brings every sublocations)
-- or should i filter only the first level of child locations

?

reagrds,
Maât

CREATE TABLE `phpgroupware_new`.`phpgw_locations` (
`location_id` int(11) NOT NULL auto_increment,
`app_id` int(11) NOT NULL,
`name` varchar(50) collate utf8_unicode_ci NOT NULL,
`descr` varchar(100) collate utf8_unicode_ci NOT NULL,
`allow_grant` smallint(6) default NULL,
`allow_c_attrib` smallint(6) default NULL,
`c_attrib_table` varchar(25) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`location_id`),
KEY `app_id` (`app_id`),
KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
Sigurd Nes
2008-10-26 14:52:42 UTC
Permalink
Post by Maât
Post by Sigurd Nes
Post by Maât
Hi all,
I'm still fighting bugs to move microstep by microstep to see .18 out
before i'm 120 years old :)
litle bit of progress today : i have a nearly installing phpgroupware
(well install does not die any more and it goes from the beginning to
the end, i can log in but there are no app available at all : just
about, home and logout)
i'm splitting the changes i made into small patches to avoid the giant
commit effect with many different things inside : each commit will
that will make patch review easier (and also make reverts easier in case
i made a mistake)
Among the issues, i found that get_subs() of class.locations.inc.php is
called from class.acl.inc.php but does not exist... with an empty method
i could prevent phpgw from crashing but i guess this method is supposed
to do something
Can someone help me either giving me the code of this method or
explaining what it is supposed to do ?
cheers,
maat (micro bug chaser)
Hi maat,
it is supposed to get a list of sub-locations for a given location.
have a look at the table phpgw_locations - the field 'name' contains information
name descr
. Top
.sub1 First submodule
.sub2 Second submodule
.sub1.sub1 First sub-sub at first sub
Regards
Sigurd
( i put the sql definition of location table in footer to help )
the name field uses a dns approach to define locations and sub locations
.location1.sublocation1
.location1.sublocation2
.location1.sublocation3
should this include sub-sub-locations ?
.location1.sublocation3.sussublocation1
.location1.sublocation3.sussublocation2
.location1.sublocation3.sussublocation3
-- should i request all name fields beginning with ".location1." (which
brings every sublocations)
Yes - that is the idea.
You give rights on all locations down the tree inherited from the level you are
operating on.

To add some extra control - you might want to add a flag for
"enable_inheritance" that you send along from the setting-form (a checkbox)

S
Post by Maât
-- or should i filter only the first level of child locations
?
reagrds,
Maât
CREATE TABLE `phpgroupware_new`.`phpgw_locations` (
`location_id` int(11) NOT NULL auto_increment,
`app_id` int(11) NOT NULL,
`name` varchar(50) collate utf8_unicode_ci NOT NULL,
`descr` varchar(100) collate utf8_unicode_ci NOT NULL,
`allow_grant` smallint(6) default NULL,
`allow_c_attrib` smallint(6) default NULL,
`c_attrib_table` varchar(25) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`location_id`),
KEY `app_id` (`app_id`),
KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
Maât
2008-10-26 15:07:26 UTC
Permalink
Post by Sigurd Nes
Post by Maât
( i put the sql definition of location table in footer to help )
the name field uses a dns approach to define locations and sub locations
.location1.sublocation1
.location1.sublocation2
.location1.sublocation3
should this include sub-sub-locations ?
.location1.sublocation3.sussublocation1
.location1.sublocation3.sussublocation2
.location1.sublocation3.sussublocation3
-- should i request all name fields beginning with ".location1." (which
brings every sublocations)
Yes - that is the idea.
You give rights on all locations down the tree inherited from the level you are
operating on.
To add some extra control - you might want to add a flag for
"enable_inheritance" that you send along from the setting-form (a checkbox)
S
the current prototype for get_subs is :

public function get_subs($appname, $location)

and it's supposed to return an array of strings :

(see Line 390 of class.acl.inc.php : http://svn.savannah.gnu.org/viewvc/core/trunk/phpgwapi/inc/class.acl.inc.php?annotate=18965&root=phpgroupware )

so i dont understand where the flag is supposed to go :-/


regards,
maat
Sigurd Nes
2008-10-26 17:04:02 UTC
Permalink
Post by Maât
Post by Sigurd Nes
Post by Maât
( i put the sql definition of location table in footer to help )
the name field uses a dns approach to define locations and sub locations
.location1.sublocation1
.location1.sublocation2
.location1.sublocation3
should this include sub-sub-locations ?
.location1.sublocation3.sussublocation1
.location1.sublocation3.sussublocation2
.location1.sublocation3.sussublocation3
-- should i request all name fields beginning with ".location1." (which
brings every sublocations)
Yes - that is the idea.
You give rights on all locations down the tree inherited from the level you are
operating on.
To add some extra control - you might want to add a flag for
"enable_inheritance" that you send along from the setting-form (a checkbox)
S
public function get_subs($appname, $location)
location_id => name
Post by Maât
(see Line 390 of class.acl.inc.php : http://svn.savannah.gnu.org/viewvc/core/trunk/phpgwapi/inc/class.acl.inc.php?annotate=18965&root=phpgroupware )
so i dont understand where the flag is supposed to go :-/
something like this:

if( $this->enable_inheritance )
{
$subs = $locations->get_subs($.., $..);
foreach ( array_keys($subs) as $sub )
{
...
}
}


Regards

Sigurd

Loading...