Page 1 of 1

Permissions and such

Posted: 11 Aug 2012, 05:04
by paul_blanchard
I am trying to figure the coding out to allow my recruiters to only see their own candidates while keeping full access intact for administrator permission level. I have managed to auto select the show only my candidates but that is system wide which wont work. Also I would like to remove the ability for recruiters to add jobs with out taking the ability to add candidates away. Any suggestions? I would really appreciate any help I can get. Thanks.

Re: Permissions and such

Posted: 07 Nov 2012, 21:57
by Laevantine
Hmm, I've got two things for you that might work. The first is the following line of code:
Code: Select all
<?php if ($this->accessLevel >= ACCESS_LEVEL_DELETE): ?>
                                                <-- INSERT WHATEVER CODE HERE-->
                                            <?php endif; ?>
Wrap this around the Only My Candidates section. There is a problem, though, which you may or may not have solved (you've probably given up or solved it already by now this is more for future people). The Only My Candidates checkbox only works correctly if someone clicks it as it is an onclick event. Having the box selected doesn't actually do anything, in fact it removes the ability to use the function altogether resulting in every candidate all the time (the opposite of what you are trying to do). There should be javascript or another function that will trigger the event but you would have to do something else rather than use the checkbox... There are a few ways to do it but I'm not a javascript/php expert. Here's the code I got to work the way you may have programmed it but it doesn't actually make it Only My Candidates. Just locks in every candidate period. Note there are different access levels. You can set this as high as you want. SHOW, EDIT, DELETE, DEMO, SA, MULTI_SA, ROOT. Stick with EDIT (edit only users), DELETE (edit/delete users), and MULTI_SA (administrators) for best results. Not sure what MULTI_SA is versus SA (SA= Site admin) so some else will have to chime in.
Code: Select all
<?php if ($this->accessLevel >= ACCESS_LEVEL_MULTI_SA): ?>
                                    
                                    <input type="checkbox" name="onlyMyCandidates" id="onlyMyCandidates" <?php if ($this->dataGrid->getFilterValue('OwnerID') ==  $this->userID): ?>checked<?php endif; ?> onclick="<?php echo $this->dataGrid->getJSAddRemoveFilterFromCheckbox('OwnerID', '==',  $this->userID); ?>" />
                                        Only My Candidates&nbsp;
                                        
                                        <?php else: ?>
                                        
                                        <input type="checkbox" name="onlyMyCandidates" id="onlyMyCandidates" <?php if ($this->dataGrid->getFilterValue('OwnerID') ==  $this->userID): ?>checked<?php endif; ?> onclick="<?php echo $this->dataGrid->getJSAddRemoveFilterFromCheckbox('OwnerID', '==',  $this->userID); ?>" />
                                        Only My Candidates&nbsp;
                                        
                                        <?php endif; ?>
For excluding the Add Job Pipeline/Companies you just need to do something similar to above but much easier. You need to go into the /modules folder and modify a few files using the ACCESS_LEVELs to your needs. I've done something similar to create a more tailored user structure. To remove the top link just below the menu bar you need to edit the JobOrdersUI.php in the joborders folder. Scroll down until you pick out ACCESS_LEVEL_EDIT around line 85 and switch it to whatever access level you want. For example, I switched it to DELETE in one of my builds so now only those with Delete privilages on up can see the Add Job Order link at the top bar. Next you need to head into Show.tpl in the joborder folder and do the same for link at the bottom. To find all the links go through your CATS consoles to find every place where the "Add to Pipeline/Add Candidate" is and find the appropriate link in the show.tpl and the "foldername"UI.php and just change the access level. You can leave, say, edit open to EDIT level but add to DELETE, MULTI_SA or however you want to. If you want a more detailed explination of how to find them I can write one but I will not find all of them for you. This applies to anyone else as well, if you have questions please ask. Dev on projects can only continue if you have an idea of how to do it.

Example from joborders/Show.tpl line 376 or so:
Original code:
Code: Select all
<?php if (!$this->isPopup): ?>
            <?php if ($this->accessLevel >= ACCESS_LEVEL_EDIT && !isset($this->frozen)): ?>
                <a href="#" onclick="showPopWin('<?php echo(CATSUtility::getIndexName()); ?>?m=joborders&a=considerCandidateSearch&jobOrderID=<?php echo($this->jobOrderID); ?>', 820, 550, null); return false;">
                    <img src="images/consider.gif" width="16" height="16" class="absmiddle" alt="add candidate" border="0" />&nbsp;Add Candidate to This Job Order Pipeline
Changed code below:
Code: Select all
<?php if (!$this->isPopup): ?>
            <?php if ($this->accessLevel >= ACCESS_LEVEL_DELETE && !isset($this->frozen)): ?>
                <a href="#" onclick="showPopWin('<?php echo(CATSUtility::getIndexName()); ?>?m=joborders&a=considerCandidateSearch&jobOrderID=<?php echo($this->jobOrderID); ?>', 820, 550, null); return false;">
                    <img src="images/consider.gif" width="16" height="16" class="absmiddle" alt="add candidate" border="0" />&nbsp;Add Candidate to This Job Order Pipeline

Re: Permissions and such

Posted: 21 Sep 2013, 13:47
by Jamez99
Thanks you for updating us with this interesting information. you did very great job. keep it up Hope you will share more ideas , I wish you good luck

Re: Permissions and such

Posted: 17 Nov 2014, 07:44
by pink
Sorry, I didn't tested the plugin in ActiveDirectory. However, it works fine with OpenLDAP and cats-0.5.5. I think some sort of tweaking needs to be done to get it working with cats-0.9. I can also provide the latest patch. Please give me some time

Re: Permissions and such

Posted: 15 Mar 2015, 01:02
by sand
Just a question .... will/can this feature be included in opencats?


Regards,

Ralf