<?xml version="1.0" encoding="utf-8"?>

<workflow xmlns="http://eprints.org/ep3/workflow" xmlns:epc="http://eprints.org/ep3/control">

  <flow>
    <epc:if test="usertype = 'user'">
      <stage ref="default" />
    </epc:if>
    <epc:if test="usertype = 'editor'">
      <stage ref="default" />
    </epc:if>
    <epc:if test="usertype = 'admin'">
      <stage ref="default" />
    </epc:if>
  </flow>

  <stage name="default">
    <epc:if test="usertype = 'user'">
      <component><field ref="password" /></component>
      <component><field ref="hideemail" /></component>
      <component><field ref="name" /></component>
      <component><field ref="dept" /></component>
      <component><field ref="org" /></component>
      <component><field ref="address" /></component>
      <component><field ref="country" /></component>
      <component><field ref="os" /></component>
      <component><field ref="url" /></component>
      <epc:if test="$STAFF_ONLY = 'TRUE'">
        <component><field ref="username" required="yes" /></component>
        <component><field ref="usertype" required="yes" /></component>
        <component><field ref="email" required="yes" /></component>
      </epc:if>
    </epc:if>
    <epc:if test="usertype = 'editor'">
      <component><field ref="password" /></component>
      <component><field ref="hideemail" /></component>
      <component><field ref="name" /></component>
      <component><field ref="dept" /></component>
      <component><field ref="org" /></component>
      <component><field ref="address" /></component>
      <component><field ref="country" /></component>
      <component><field ref="os" /></component>
      <component><field ref="url" /></component>
      <component><field ref="frequency" /></component>
      <component><field ref="mailempty" /></component>
      <epc:if test="$STAFF_ONLY = 'TRUE'">
        <component><field ref="editperms" /></component>
        <component><field ref="username" required="yes" /></component>
        <component><field ref="usertype" required="yes" /></component>
        <component><field ref="email" required="yes" /></component>
      </epc:if>
    </epc:if>
    <epc:if test="usertype = 'admin'">
      <component><field ref="password" /></component>
      <component><field ref="hideemail" /></component>
      <component><field ref="name" /></component>
      <component><field ref="dept" /></component>
      <component><field ref="org" /></component>
      <component><field ref="address" /></component>
      <component><field ref="country" /></component>
      <component><field ref="os" /></component>
      <component><field ref="url" /></component>
      <component><field ref="editperms" /></component>
      <component><field ref="frequency" /></component>
      <component><field ref="mailempty" /></component>
      <epc:if test="$STAFF_ONLY = 'TRUE'">
        <component><field ref="username" required="yes" /></component>
        <component><field ref="usertype" required="yes" /></component>
        <component><field ref="email" required="yes" /></component>
      </epc:if>
    </epc:if>
  </stage>

</workflow>

