Closed laftho closed 7 years ago
@TyIsI you can use this like:
$curr = CurrentUser::getPrincipal();
CurrentUser::setPrincipal(new SystemPrincipal());
..... privileged code .....
CurrentUser::setPrincipal($curr);
Ideally there'd be some sort of dipose pattern in php but I'm not sure there is. ie:
using(new SystemPrincipal()) { ..... }
and then we change the SystemPrincipal constructor and deconstructor to take the current principal, store it and then reset it on desconstruct.
Approval by merge.
@TyIsI you can use this like:
$curr = CurrentUser::getPrincipal();
CurrentUser::setPrincipal(new SystemPrincipal());
..... privileged code .....
CurrentUser::setPrincipal($curr);
Ideally there'd be some sort of dipose pattern in php but I'm not sure there is. ie:
using(new SystemPrincipal()) { ..... }
and then we change the SystemPrincipal constructor and deconstructor to take the current principal, store it and then reset it on desconstruct.