Issue
Following is my code:
<?php
$acl_test = "companies";
$act_test2 = "contractor";
if (!($this->acl->hasPermission($acl_test)) && ($this->acl->hasPermission($acl_test2))) {
?>
<li <?php print ($selected == 'companies' || $selected == 'contractor') ? 'class="selected"' : ''; ?>>
<a class="top-level" href="#">Clients</a>
<ul>
<li><a href="<?php print site_url('companies'); ?>">Company</a></li>
<li><a href="<?php print site_url('contractors'); ?>">Contractor</a></li>
</ul>
</li>
<?php } ?>
Now, want I would like to do is basically, I am validating that logged in user has the permission to view the following link. This works fine if i put the check individually on each link. Although i any user has the one of the permission that he would be able to see the Clients link. Now, if any user does not have any permission to view link then he should not able to see the Clients link either. But something wrong with logical operation.
Any suggestion?
Solution
Although if any user has the one of the permission that he would be able to see the Clients link. Now, if any user does not have any permission to view link then he should not able to see the Clients link either.
do you mean if any of that permission is true you will let the user see the link? if that's the case, why don't you try:
if($this->acl->hasPermission($acl_test) || $this->acl->hasPermission($acl_test2)){
// do something
}
Answered By - Ceeee
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.