Search for Resources and Solutions

How to enable or disable apps and components for a Team's member

From the version 0.0.7.9 Midrub allows to users to manage the permissions for their Team's roles. Users can create new roles and decide anytime which permissions has a role. For example the user can restrict access to more apps or features from Midrub.

If you're creating new apps/components you have to write the hooks for Team's roles and with a simple function you can decide if the Team's member will have or no access to a feature in your app or component. 

For menu in the user dashboard you have to configure only the check_availability method in your app or component:



    public function check_availability() {

        if ( !get_option('app_stream_enable') || !plan_feature('app_stream') || !team_role_permission('stream') ) {
            return false;
        } else {
            return true;
        }
        
    }

Let's explain what means the code above:

  • get_option('app_stream_enable') - verifies if the app/component is enabled.
  • plan_feature('app_stream') - verifies if the app is enabled per plan, for components you don't need this.
  • team_role_permission('stream') - verifies if the team's role of the current member has the permission to access this app/component.


If you have configured the method check_availability you are ok. 


Was this article helpful?