Know which categories are "secret"



  • When you fetch the categories a user can see by privilege, is there a way of telling whether the category is visible for everyone or if they are "private"?

    Is there a way I can get the privileges assigned to a user and compare those to the privileges required for a category?

    I'm browsing source right now, but if anyone have the answer on the top of their head, please give me a hand to save time.


  • GNU/Linux Admin

    Ah... not really, since it's not quite that simple. Privileges aren't as simple as "visible to you"/"invisible to regular users", but can be customized on different user groups and even individual users.

    So that said, while we could add in something like "category is visible to you but not to all registered users", that means different things for different people, since (just as an example) a forum could be completely locked down, in which case this property wouldn't mean anything at all (since all categories, if you can see them, are visible to you, but not to all registered users)


  • Staff Admin

    @magnusvhendin You can call these two functions to check what privileges a user/group has on a specific category. For example

    privileges.categories.groupPrivileges(cid, 'registered-users', callback); Will tell you if category cid is visible to registered-users or not in the find field and so on.



  • @baris Nice! Thank you so much! Exactely what I was looking for.


Log in to reply
 

Suggested Topics

  • 1
  • 1
  • 9
  • 4
  • 1
| |