offline permissions in yii2

How to check permissions of offline user? Is there any technique?

What do you mean by that?

In this project user can logged in as demo, premium and business users. After logged in he can create forms(job application form, voter id form etc…). If he is a demo user he able to create only 2 forms. If user premium user, able to create 6 forms like…

After successfully created he can send the link of that form to his friends through email. After successfully received by his friends they can fill those forms. His friends are now offline users. If they are friends of demo user they can’t fill, if they are friends of premium user they can fill that form.

You can use something like

$this->getAuthManager()->checkAccess($user_id, $permissionName, $params);

but what you should do is to add the rule which checks type of current user’s friend.

Still i didn’t add the any rule to check user’s friend, just i thinking about it.

is this code right?

if ( count( $formdetail ) > 0 ) {

            $logoffuser_id = $formdetail->user_id;

                        $user_type = '';

			$user_id       = Yii::$app->user->id;



				foreach($user_roles as $user_role){

						$user_type  = $user_role->name;



            if($user_type  == 'demo_user'){

				$this->limit_accessibility = PlanHelper::getPlan( "demo_user" );

			} else if ($user_type  == 'premium_user'){

				  $this->limit_accessibility = PlanHelper::getPlan( "premium_user" );

			} else if ($user_type == 'business_user')  {	 

				$this->limit_accessibility = PlanHelper::getPlan( "business_user" );

			} else {

				$this->limit_accessibility = PlanHelper::getPlan();