Changeset 2935


Ignore:
Timestamp:
Nov 17, 2006, 2:12:27 PM (16 years ago)
Author:
Nicklas Nordborg
Message:

Test program now sets USE permission to plugins since the default has changed and
everyone no longer has permission.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r2845 r2935  
    103103    <pathelement location="${core.build}"/>
    104104    <pathelement location="${jobagent.build}"/>
     105    <pathelement location="${coreplugins.build}" />
    105106  </path>
    106107
  • trunk/doc/test/roles/index.html

    r2769 r2935  
    257257    </tr>
    258258    </table>
    259   </li>
     259    <p>
     260  </li>
     261 
     262  <li>Give USE permission for the listed users to the following plugins:
     263 
     264    <table class="listing" cellspacing="0" cellpadding="2" border="0">
     265    <tr>
     266      <th>User</th>
     267      <th>Plugins</th>
     268    </tr>
     269    <tr>
     270      <td>Power user</td>
     271      <td>
     272        <ul>
     273        <li>Reporter importer</li>
     274        <li>Plate importer</li>
     275        <li>Reporter map importer</li>
     276        <li>Print map importer</li>
     277        </ul>
     278      </td>
     279    </tr>
     280    </table>
     281  </li>
     282
    260283  </ol>
    261284
  • trunk/src/test/net/sf/basedb/test/roles/AdminTest.java

    r2259 r2935  
    2424package net.sf.basedb.test.roles;
    2525
     26import java.util.Collection;
    2627import java.util.Collections;
     28import java.util.EnumSet;
     29import java.util.HashSet;
     30import java.util.Set;
    2731
    2832import net.sf.basedb.core.DbControl;
    2933import net.sf.basedb.core.Directory;
    3034import net.sf.basedb.core.Group;
     35import net.sf.basedb.core.MultiPermissions;
     36import net.sf.basedb.core.Permission;
     37import net.sf.basedb.core.PluginDefinition;
    3138import net.sf.basedb.core.Quota;
    3239import net.sf.basedb.core.Role;
     40import net.sf.basedb.core.SharedItem;
    3341import net.sf.basedb.core.SystemItems;
    3442import net.sf.basedb.core.User;
     43import net.sf.basedb.plugins.PlateFlatFileImporter;
     44import net.sf.basedb.plugins.PrintMapFlatFileImporter;
     45import net.sf.basedb.plugins.ReporterFlatFileImporter;
     46import net.sf.basedb.plugins.ReporterMapFlatFileImporter;
    3547import net.sf.basedb.test.TestUtil;
    3648
     
    7082      User guest = createGuest(dc, g);
    7183      dc.commit();
     84     
     85      // Give permission to plugins
     86      dc = TestUtil.getDbControl();
     87      Set<Permission> USE = EnumSet.of(Permission.USE);
     88      Set<SharedItem> plugins = new HashSet<SharedItem>();
     89      plugins.add(PluginDefinition.getByClassName(dc, ReporterFlatFileImporter.class.getName()));
     90      plugins.add(PluginDefinition.getByClassName(dc, PlateFlatFileImporter.class.getName()));
     91      plugins.add(PluginDefinition.getByClassName(dc, ReporterMapFlatFileImporter.class.getName()));
     92      plugins.add(PluginDefinition.getByClassName(dc, PrintMapFlatFileImporter.class.getName()));
     93      addPermissions(dc, powerUser, plugins, USE);
     94      dc.commit();
     95     
    7296      TestUtil.logout();
    7397    }
     
    140164  }
    141165 
     166  public static void addPermissions(DbControl dc, User user, Collection<SharedItem> items, Set<Permission> permissions)
     167  {
     168    MultiPermissions mp = new MultiPermissions(items);
     169    mp.setPermissions(user, permissions);
     170    mp.updateKeys(dc);
     171  }
     172 
    142173}
Note: See TracChangeset for help on using the changeset viewer.