vhs / nomos

Membership management system made VHS-centric
25 stars 7 forks source link

add system principal #243

Closed laftho closed 7 years ago

laftho commented 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.

TyIsI commented 7 years ago

Approval by merge.