Keyword

Does K2ModelCategories respect K2 user group authorization ?

  • Jean Machuron
  • Jean Machuron's Avatar Topic Author
  • Offline
  • New Member
More
3 years 10 months ago #176152 by Jean Machuron
Hello

We use K2 combined with CB to allow CB users to post in specific categories

CB users are affected to K2 groups by a CB autoaction and they correctly belong to specific groups

Then we have Three K2 groups with different post categories authorizations for each group within a single may blog category

However it seems that using K2ModelCategories does not allow to respect the K2 user authorizations

Did you change something in the API ?

CB team use :

$categories = new K2ModelCategories();
$cache = $categories->categoriesTree( null, true, true );

to display categories and get authorizations from k2 for a specific users

Is that still correct ?
do you have other triggers better suited ?

Thanks for the help
Jean

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

More
3 years 10 months ago #176169 by JoomlaWorks
These are backend model calls.

If your customized code runs in the frontend, you need to call the model with the right context if you use the Joomla API or just require the file using its full path.

See how the "categoriesTree" method is used here: github.com/getk2/k2/search?q=categoriesTree&unscoped_q=categoriesTree

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Jean Machuron
  • Jean Machuron's Avatar Topic Author
  • Offline
  • New Member
More
3 years 10 months ago #176175 by Jean Machuron
Thanks, will report back to Kyle from CB team and see what they can correct

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

More
3 years 10 months ago #176183 by JoomlaWorks
Great :)

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Jean Machuron
  • Jean Machuron's Avatar Topic Author
  • Offline
  • New Member
More
3 years 10 months ago #176204 by Jean Machuron
Thanks Fotis

Here is Kyle question ?

"Their API is unclear. K2ModelCategories->categoriesTree is the only category output that provides HTML ready for select options, but it does not check access. K2ModelItemlist->getCategoriesTree checks access, but is not HTML ready for select options. I don't know what API they're expecting me to use here and if I need to be processing the results into HTML ready select options or not myself."

Mind to tell me what to do ?
Thanks

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

More
3 years 10 months ago #176213 by JoomlaWorks
Yeah, sorry we don't have the exact HTML ready. But it's not difficult to search the code for relevant examples, as the drop-down is used in many places. E.g.:

github.com/getk2/k2/blob/e574284dfbef1cc01d967b08fb734fcf90e41faf/administrator/components/com_k2/views/categories/view.html.php#L143-L149

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Jean Machuron
  • Jean Machuron's Avatar Topic Author
  • Offline
  • New Member
More
2 years 11 months ago #178738 by Jean Machuron
I am coming back on this subject.
CB team implemented group support but this is standard joomla user group support
The question is : how can we retrieve proper K2 GROUPS user support to display the correct categories in the front end ?
What is the API to be used for this ?

Apart of :
$items = new K2ModelItemlist();
$allowed = $items->getCategoriesTree();

What is needed exactly to display the categories that the user can access not with joomla access groups permissions but with K2 user groups permissions ??

Kyle would be ready to code something but has no clue neither

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

More
2 years 11 months ago #178763 by JoomlaWorks
K2 User Groups are used for frontend editing (primarily).

I need you to explain the exact process you want users to follow so I can tell you whether what you're asking is possible and if so, how...

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Jean Machuron
  • Jean Machuron's Avatar Topic Author
  • Offline
  • New Member
More
2 years 11 months ago #178777 by Jean Machuron
Joomla / CB users can add and edit K2 articles through CB Blogs K2 model.
Selecting categories with CB Blogs is fine and respect joomla users groups.
However it does not respect K2 users groups.
What we want is a way to force categories to respect K2 users groups authorization in the front end for add/edit/delete their own K2 articles.

Do you have an API to filter categories according to K2 users groups permissions in the front end ? and if not how can we implement this as K2 does ??

thanks

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

More
2 years 11 months ago #178783 by JoomlaWorks

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum