1

I'm using k2. I need to restrict "group A" users can see "Items" only.

How can I do that?

Any dirty/hacky ways are acceptable no matter what.

Thank you.

1

You don't have to use any component or plugin to control your k2 access. You can create groups and set permissions in Joomla Users Groups.

  1. To create new group go to Menu: User >> Groups >> Add New Gorup like "Group A";
  2. Users >> Access Levels >> Add New Access level like "Group A" and select check box "Group A" you creat in step 1;
  3. Creat users and set his group to "Group A";
  4. In K2, create content and set permission to "Group A" created in step 1.
0

There is no need to apply any hack in k2 code when solution can be built by using triggers.

If you are comfortable with coding then you can create a plugin which work on k2 triggers and restrict usergroup to access set of resource only.

K2 triggers onK2PrepareContent event which can be used in the plugin.

Add checking of the user permission in this event in your plugin and redirect if user is not allowed to access.

Another event which you can utilize is onAfterRoute event, it's a joomla event.

In this event you can check the option, view, task and layout to confirm the current access page. And apply usergroup checking.

  • Thankyou for quick response. so with this way, do u mean the user cannot "access" instead of "cant see"? what i need to do is the user even "cant see" this option. then i use "onAfterRoute" for another non-k2 components? – littleshell Feb 27 '15 at 6:19
  • you can control complete output, so if you want user cant see that content then just replace/remove it or redirect user to some other page. – Nick Feb 27 '15 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.