Giter Club home page Giter Club logo

permission2categories's Introduction

Permission2Categories

Permission 2 Categories is a plugin for Question 2 Answer. P2C enables you to set permission levels for your categories.

Installation

To install, simply place the permission2categories folder in your qa-plugins directory.

How it works

After installation, when you edit a category in the admin section you will notice a select box. Simply choose the permission level you would like to set and then all questions in that category will be hidden from users of lower level.

Behind the secnes, P2C adds a security check layer. It will check the logged in users permission level vs the one set for the category. If the user does not have sufficient privileges, they will be unable to view the question and it will be hidden from the question list. In addition any category above the users privilage will also be hidden from the categories page.

Side Notes

P2C treats sub-categories as a normal category, it does not take it's parent category permission level into account. Meaning that if your parent categories permission level is set to 'Admin' but the sub-categories permit level is 'Anyone' - then the sub-category will be viewable by anyone.

Category permission levels are stored in the qa_categorymetas table.

permission2categories's People

Contributors

kfuchs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

permission2categories's Issues

Is this use case supported?

Hi Kirill,
First off apologies - I have not programmed for a loooong time, and so this is a first time Github post, questions2answer use, permissions2categories use all in one day. I do apologies if this isn't the best way to ask the question I have - if so please point me in the right direction.

Second off, a huge thanks for taking the effort of making permissions2categories public!

My question is whether what I'm trying to do is actually supported by permissions2categories plugin or not.

Basically I want some categories to only support creation/editing/deleting/recategorizing actions by higher privileged users. Is this possible? Out of the box, permissions2categories just hides entire categories from lower privilege users - whereas I want everyone to be able to read everything. I have played around but couldn't get it to work - perhaps if I rolled my sleeves up and did something inside qa_categorymetas? Thanks in advance for any help.

Stephan

private category

is this plugin useful to set privacy to a category of user (a post will be visible to only the user who asked the question and the admins)

rss feeds still include the blocked categories.

For meanwhile I did a core hack to qa-feed.php. I added an if to check for this catgoryid.

//  Build the inner XML structure for each item

If ($question['categoryid'] == 14) {

} else {
$lines[]='';
$lines[]='<title>'.qa_xml($titleprefix.$question['title']).'</title>';
$lines[]=''.$urlxml.'';

    if (isset($htmlcontent))
        $lines[]='<description>'.qa_xml($htmlcontent).'</description>';

    if (isset($Author))
        $lines[]='<author>'.qa_xml($Author).'</author>';

    if (isset($question['categoryname']))
        $lines[]='<category>'.qa_xml($question['categoryname']).'</category>';

    $lines[]='<guid isPermaLink="true">'.$urlxml.'</guid>';

    if (isset($time))
        $lines[]='<pubDate>'.qa_xml(gmdate('r', $time)).'</pubDate>';

    $lines[]='</item>';

}

Pagination Bug

We are using this plugin to hide post with an "建築家のみ" category (This category is for admin only, I attached screenshot) from other users, but this plugin has not been updated for 2-3 years.

Screenshot: in admin side
http://www.question2answer.org/qa/?qa=blob&qa_blobid=9872234809254930832

If you will go to this link http://kenchiku4.com/index.php?qa=questions&start=6 you will see that some post is not here but you can select the "2nd" page of the pagination but If you login as an admin you will be able to see that there are post on the 2nd page. The reason is that some post in 2nd page has a category for "admin" only.

We set that there should be 6 posts per page in the pagination.

Has anyone encounter this before and how do you fix it? It would be great if you could help me or suggest something.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.