Skip to Content.
Sympa Menu

comanage-dev - [comanage-dev] change to table column definitions for groups

Subject: COmanage Developers List

List archive

[comanage-dev] change to table column definitions for groups


Chronological Thread 
  • From: Scott Koranda <>
  • To: comanage-dev <>
  • Subject: [comanage-dev] change to table column definitions for groups
  • Date: Thu, 12 Apr 2012 13:01:43 -0500

Hi,

At

http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html

we read

"Rather than using an auto-increment key as the primary key,
you may also use char(36). Cake will then use a unique 36
character uuid (String::uuid) whenever you save a new record
using the Model::save method."

I edited Config/Schema/schema.xml appropriately so that the
cm_co_groups and cm_co_group_members use a 36 character field
for the primary key.

I re-deployed and tested and found no problems using the
existing code base with this change. It "just works". The
noticeable effect is in certain URLs (when doing group work)
instead of a small integer one finds a 36 character string.
But it works.

I propose we make this change.

The reason is that with this change in place the data that
gets sent to the create() method for my Grouper data source(s)
is

Array
(
[co_id] => 1
[name] => admin
[description] => COmanage Platform Administrators
[open] =>
[status] => A
[modified] => 1334252419
[created] => 1334252419
[id] => 4f871383-c6a0-487c-9060-10e75bb7f614
)

Note the 'id'. It is generated by CakePHP and guaranteed
unique.

This is quite helpful because I can simply attach it to a
group or membership as an attribute.

Without this, I need to write code that implements in Grouper
an auto-incrementing integer field. I did that by using an
attribute on a stem to hold a counter, but it requires

- a read to get the current value
- creation of an auxilliary group in a 'hidden' stem with that
group name (i.e. '1' or '2' or ...) to make sure the id will
be unique (heading off a race condition). This can fail in a
race so the algorithm keeps going and incrementing the
counter/label by one until it succeeds in creating the group
- updating of the counter attribute with the latest value

The result is slow and requires those auxiliary and mostly
meaningless groups that are nothing but placeholders with
names '1', '2', '3', and so on.

Because the propose change "just works" for the standard code
base and makes the Grouper plugin significantly faster and
less brittle I ask that we make that change. In my opinion the
reward outweighs the cost of having some URLs longer with a
UUID instead of a simple integer.

Thanks,

Scott



Archive powered by MHonArc 2.6.16.

Top of Page