Keyword

Limit K2 items based on usergroups?

  • Kai Roen
  • Kai Roen's Avatar Topic Author
  • Offline
  • Senior Member
More
13 years 7 months ago #93878 by Kai Roen
Limit K2 items based on usergroups? was created by Kai Roen
I love K2, and I have been using K2 for a long time. Since the development of K2 for Joomla 1.6 has been delayed, I need a function in K2 (for Joomla 1.5) that limit the view of items in frontend based on usergroups.

Is it a easy way of implement this in K2?

Since there are settings of usergroups in K2 for frontend editing, can I also use the same settings for limit the view of items for specified category/categories?

 

Please Log in or Create an account to join the conversation.

More
13 years 7 months ago #93879 by micael jansson
Replied by micael jansson on topic Limit K2 items based on usergroups?
I have the same issue. I want the limit access to information in my application based on the access levels that user groups define or in other words use user groups to control access throughout the application. I assume this could be done by using some session variable where user group id is stored for the user/session. 

Please Log in or Create an account to join the conversation.

  • Kai Roen
  • Kai Roen's Avatar Topic Author
  • Offline
  • Senior Member
More
13 years 7 months ago #93880 by Kai Roen
Replied by Kai Roen on topic Limit K2 items based on usergroups?
Take a look at my blog regarding this issue. I managed to tweak my K2 site to limit the view of items in frontend

kairoen.posterous.com/limit-k2-items-based-on-usergroups-for-joomla

 

/Kai


micael jansson said:

I have the same issue. I want the limit access to information in my application based on the access levels that user groups define or in other words use user groups to control access throughout the application. I assume this could be done by using some session variable where user group id is stored for the user/session. 

Please Log in or Create an account to join the conversation.

More
13 years 7 months ago #93881 by micael jansson
Replied by micael jansson on topic Limit K2 items based on usergroups?
Thanks Kai, I can use an similar solution in my case.

 

But how is access controlled in K2 today? In my mind the session variable should already exist to handle writing permission end so on. However I have search for it in K2 code without finding it.  

Please Log in or Create an account to join the conversation.

  • Kai Roen
  • Kai Roen's Avatar Topic Author
  • Offline
  • Senior Member
More
13 years 7 months ago #93882 by Kai Roen
Replied by Kai Roen on topic Limit K2 items based on usergroups?
There are no ACL in K2.

This will be fixed (hopefully) in Joomla 1.6 version of K2 - but for Joomla 1.5 users, you have no option.

 

This functionality should be a high priority for developers at Joomlaworks. I love Joomla 1.5 - I don't really care about Joomla 1.6 because 1.6 it pretty useless for now - no usable extensions are available at the moment.

 

micael jansson said:

Thanks Kai, I can use an similar solution in my case.

 

But how is access controlled in K2 today? In my mind the session variable should already exist to handle writing permission end so on. However I have search for it in K2 code without finding it.  

Please Log in or Create an account to join the conversation.

More
13 years 7 months ago #93883 by marioglez
Replied by marioglez on topic Limit K2 items based on usergroups?
Kai, do you think using the hack you mention along with Juga groups ACL it would work?

Kai Roen said:
Take a look at my blog regarding this issue. I managed to tweak my K2 site to limit the view of items in frontend

kairoen.posterous.com/limit-k2-items-based-on-usergroups-for...

 

/Kai

micael jansson said:

I have the same issue. I want the limit access to information in my application based on the access levels that user groups define or in other words use user groups to control access throughout the application. I assume this could be done by using some session variable where user group id is stored for the user/session. 

Please Log in or Create an account to join the conversation.

  • Kai Roen
  • Kai Roen's Avatar Topic Author
  • Offline
  • Senior Member
More
13 years 7 months ago #93884 by Kai Roen
Replied by Kai Roen on topic Limit K2 items based on usergroups?
@marioglez

I am not sure about Juga, because I have never used it. But It should be easy to use the same hack, because you only need to change the SQL. The hack is just a SQL query with IDs for ACL group(s), and change the if statement with corresponding category ids and groupid.

Please Log in or Create an account to join the conversation.

More
13 years 7 months ago #93885 by micael jansson
Replied by micael jansson on topic Limit K2 items based on usergroups?
Hello Kai, in your code example you add step 1 in category.php witch works well in your example.

 

A more general solution as I see it would be to add step 1, directly after log-in is confirmed.

That is to put the access control variable in session directly after login.

 

I am no php-programmer but I suspects that any ware after the Statement

$user = &Jfactory::getUser();

in modules/mod_K2_login /mod_K2_login.php would be a god place.

 

Is it possible for you ( or anyone working with K2 ) to confirm this or point out where the best place is to add the code for the access control variable, for a general solution. 



Kai Roen said:
Take a look at my blog regarding this issue. I managed to tweak my K2 site to limit the view of items in frontend

kairoen.posterous.com/limit-k2-items-based-on-usergroups-for...

 

/Kai

micael jansson said:

I have the same issue. I want the limit access to information in my application based on the access levels that user groups define or in other words use user groups to control access throughout the application. I assume this could be done by using some session variable where user group id is stored for the user/session. 

Please Log in or Create an account to join the conversation.

  • Kai Roen
  • Kai Roen's Avatar Topic Author
  • Offline
  • Senior Member
More
13 years 7 months ago #93886 by Kai Roen
Replied by Kai Roen on topic Limit K2 items based on usergroups?
Hello Michael,

yes, you can of course put this code in step1 in other PHP files inside your K2 templates. The reason I used the category.php, is that I wanted to add this functionality only for this special template. I created a special template, and using template overrides functionality to tweak my site. This is just a few pointers to other who are looking for similar functionality.

 

The reason I included the PHP code inside category.php, was only to hide items in blog/category view for a certain K2 template.

Please Log in or Create an account to join the conversation.

More
13 years 7 months ago #93887 by micael jansson
Replied by micael jansson on topic Limit K2 items based on usergroups?
Hello Kai, that was an fast answer! I understand your case. But as I have no experience in php programming I wondered if you, or someone else, can confirm my assumption that the place to put the code for the access control variable in session, if you want it to be accessible directly after login, is in modules/mod_K2_login /mod_K2_login.php after $user = &Jfactory::getUser(); Thanks in advance.  

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum