LDAP: Adding groups to gallery

plepe

Joined: 2013-03-26
Posts: 1
Posted: Thu, 2013-04-11 07:56

Hi! After a long struggle I made the ldap module work on my installation. I found and fixed several bugs, as you can see in this pull request: https://github.com/gallery/gallery3-contrib/pull/150

Unfortunately there's still one major issue: I have several groups of users which should have different access levels on the gallery albums. When I add the group(s) to the 'groups' array in modules/ldap/config/identity.php and a user who is member of this group logs in, I get the following error message:

2013-04-08 13:47:02 +02:00 --- error: Kohana_Exception [ 42 ]: The view_21003 property does not exist in the Item_Model class
/home/httpd/htdocs/gallery3/system/libraries/ORM.php [ 398 ]
#0 /home/httpd/htdocs/gallery3/modules/gallery/models/item.php(338): ORM_Core->__get('view_21003')
#1 /home/httpd/htdocs/gallery3/modules/gallery/helpers/access.php(109): Item_Model_Core->__get('view_21003')
#2 /home/httpd/htdocs/gallery3/modules/gallery/helpers/access.php(82): access_Core::user_can(Object(Ldap_User), 'view', Object(Item_Model))
#3 /home/httpd/htdocs/gallery3/modules/gallery/helpers/access.php(124): access_Core::can('view', Object(Item_Model))
#4 /home/httpd/htdocs/gallery3/modules/gallery/controllers/albums.php(32): access_Core::required('view', Object(Item_Model))
#5 /home/httpd/htdocs/gallery3/modules/gallery/controllers/albums.php(22): Albums_Controller->show(Object(Item_Model))
#6 [internal function]: Albums_Controller->index()
#7 /home/httpd/htdocs/gallery3/system/core/Kohana.php(331): ReflectionMethod->invokeArgs(Object(Albums_Controller), Array)
#8 [internal function]: Kohana_Core::instance(NULL)
#9 /home/httpd/htdocs/gallery3/system/core/Event.php(208): call_user_func_array(Array, Array)
#10 /home/httpd/htdocs/gallery3/application/Bootstrap.php(67): Event_Core::run('system.execute')
#11 /home/httpd/htdocs/gallery3/index.php(116): require('/home/httpd/htd...')
#12 {main}

21003 is the gidNumber of the group in question. Sure, the view_21003 column has not been created in the items table in the database. What we should/could implement is a check, whether the column(s) in question have been created and to create them if not ... or we could go the long way and implement an UI for configuring the LDAP module, which could take care of creating these columns.

For now I created the columns in question by temporarily adding the following code to the Ldap_Group's constructor - but this is not a final solution (don't worry, it's not part of the pull request):
try {
access::add_group($group);
}
catch(Exception $e) {
// columns have already been created
}

So, any ideas on this?

Plepe.