mercredi 3 février 2016

Wordpress File Away Plugin - Restrict folders/directory access based on the User Role

While registration, user will select either of the value from dropdown i.e. Nexus 5 or Nexus 6. Option value is with space i.e. (Nexus 6)

<select tabindex="10" class="form-control login-field" data-toggle="select" name="reg_product_no" id="reg-product-no" required>
  <option value="" disabled selected>Product Number</option>
  <option value="Nexus 6">Nexus 6</option>
  <option value="Nexus 5">Nexus 5</option>
</select>

On successful registration, it shows up under User Meta as Product Number. The code is <input type="text" value="Nexus 5" class="regular-text" name="product_no">

Admin has made two directories Nexus 5 and Nexus 6 and uploaded relevant files under those. User with role google can see and access both the directories. Now, if a user with role normal has selected value Nexus 5 from dropdown can see and access only Nexus 5 folder; the meta data saved will be Nexus 5.

I have three user roles defined in my website as below

  1. administrator (upload files and folders using file away plugin)
  2. google (can access both Nexus 5 and 6 directories)
  3. normal (should access either directory based on option value selected)

How do I allow normal role user to access only Nexus 5 directory and not Nexus 6 ? The same logic goes if selected Nexus 6 from dropdown. I have tried below plugin code but its not working

[fileaway showto="normal,administrator" type="table" paginate="true" pagesize="10" searchlabel="Search" datelabel="Date" theme="silver-bullet" heading="Software Package" hcolor="silver" directories="on"]
[fileaway sub="fa-usemeta(product_no)" showto="normal" type="table" paginate="true" pagesize="10" searchlabel="Search" datelabel="Date" theme="silver-bullet" heading="Software Package" hcolor="silver"]
[fileup sub="Nexus 6" showto="administrator" makedir="true" maxsize="500"]
[fileup sub="Nexus 5" showto="administrator" makedir="true" maxsize="500"]

Plugin URL - http://ift.tt/OhQ2ce



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire