This forum is archived. Posts are preserved for historical reference. For current help, join us on Discord.

How to use hasPerm

In UserSpice 4.4 · Started by Aido on 2019-07-20 5:05 am · 13755 views · 1 replies

I try to use this function in my code 
but even using the 
[size=x-small]var_dump(((hasPerm([2],$user->data()->id))))[/size]

[color=#000000][size=small]generates the problem with other code first with JS part. without it the code works fine but i need to control some permissions.[/size][/color]

[color=#000000][size=small]I understand it is a kind of interference with something but I have no idea where...[/size][/color]

[color=#000000][size=small]What am i doing wrong?[/size][/color]

I've checked the hasPerm implementation and found that I can skip the id parameter and it will be set by hasPerm itself so i deleted the id.
The short version with permissions only works in my case.
What are you trying to accomplish? I don't see any javascript there. Try this

if(hasPerm([2],$user->data()->id)){
die("Has permission);
}else{
die("Does not have permission");
}