<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:five="http://namespaces.zope.org/five"
    xmlns:cmf="http://namespaces.zope.org/cmf"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    i18n_domain="senaite.core">

<!--
    All the available permissions are defined here. Each new line will be a
    new permission. Each permission has two attributes: a short ID and a
    long title. The ID will be used for zope3-like permissions such as ZCML
    configuration files. The long title will be used for zope2-like
    permissions such as sm.checkPermission.

    In order to avoid typo errors, we will use pseudoconstants instead of
    permission string values. these constants are defined in permissions.py

    The two files (permissions.py and permissions.zcml) must be kept in sync.
/-->

# Add Permissions:
# ----------------
<permission id="bika.lims.permissions.AddAnalysisProfile" title="BIKA: Add AnalysisProfile"/>
<permission id="bika.lims.permissions.AddARTemplate" title="BIKA: Add ARTemplate"/>
<permission id="bika.lims.permissions.AddAnalysis" title="BIKA: Add Analysis"/>
<permission id="bika.lims.permissions.AddAnalysisRequest" title="BIKA: Add Analysis Request"/>
<permission id="bika.lims.permissions.AddAnalysisSpec" title="BIKA: Add AnalysisSpec"/>
<permission id="bika.lims.permissions.AddAttachment" title="BIKA: Add Attachment"/>
<permission id="bika.lims.permissions.AddBatch" title="BIKA: Add Batch"/>
<permission id="bika.lims.permissions.AddClient" title="BIKA: Add Client"/>
<permission id="bika.lims.permissions.AddInvoice" title="BIKA: Add Invoice"/>
<permission id="bika.lims.permissions.AddMethod" title="BIKA: Add Method"/>
<permission id="bika.lims.permissions.AddMultifile" title="BIKA: Add Multifile"/>
<permission id="bika.lims.permissions.AddPricelist" title="BIKA: Add Pricelist"/>
<permission id="bika.lims.permissions.AddSample" title="BIKA: Add Sample"/>
<permission id="bika.lims.permissions.AddSupplyOrder" title="BIKA: Add SupplyOrder"/>
<permission id="bika.lims.permissions.AddSamplePoint" title="BIKA: Add SamplePoint"/>
<permission id="bika.lims.permissions.AddSampleMatrix" title="BIKA: Add SampleMatrix"/>
<permission id="bika.lims.permissions.AddSamplePartition" title="BIKA: Add SamplePartition"/>
<permission id="bika.lims.permissions.AddSamplingDeviation" title="BIKA: Add SamplingDeviation"/>
<permission id="bika.lims.permissions.AddSRTemplate" title="BIKA: Add SRTemplate"/>
<permission id="bika.lims.permissions.AddSubGroup" title="BIKA: Add Sub-group"/>
<permission id="bika.lims.DispatchOrder" title="BIKA: Dispatch Order"/>
<permission id="bika.lims.ManageARImport" title="BIKA: Manage ARImport"/>


# Old stuff I haven't looked at
# =============================
<permission id="bika.lims.ManageBika" title="BIKA: Manage Bika"/>
<permission id="bika.lims.ManageClients" title="BIKA: Manage Clients"/>
<permission id="bika.lims.ManageWorksheets" title="BIKA: Manage Worksheets"/>
<permission id="bika.lims.ManageAnalysisRequests" title="BIKA: Manage Analysis Requests"/>
<permission id="bika.lims.ManageSamples" title="BIKA: Manage Samples"/>
<permission id="bika.lims.ManageSuppliers" title="BIKA: Manage Reference Suppliers"/>
<permission id="bika.lims.ManageReference" title="BIKA: Manage Reference"/>

# Stuff I sorted out
# ==================
# For workflow transitions:
# -------------------------
<permission id="bika.lims.permissions.ScheduleSampling" title="BIKA: Schedule Sampling"/>
<permission id="bika.lims.SampleSample" title="BIKA: Sample Sample"/>
<permission id="bika.lims.PreserveSample" title="BIKA: Preserve Sample"/>
<permission id="bika.lims.ReceiveSample" title="BIKA: Receive Sample"/>
<permission id="bika.lims.ExpireSample" title="BIKA: Expire Sample"/>
<permission id="bika.lims.DisposeSample" title="BIKA: Dispose Sample"/>

<permission id="bika.lims.ImportAnalysis" title="BIKA: Import Analysis"/>
<permission id="bika.lims.RejectWorksheet" title="BIKA: Reject Worksheet"/>

<permission id="bika.lims.Retract" title="BIKA: Retract"/>
<permission id="bika.lims.Verify" title="BIKA: Verify"/>
<permission id="bika.lims.Publish" title="BIKA: Publish"/>
<permission id="bika.lims.CancelAndReinstate" title="BIKA: Cancel and reinstate"/>

# For screen navigation:
# ----------------------
<permission id="bika.lims.EditSample" title="BIKA: Edit Sample"/>
<permission id="bika.lims.EditWorksheet" title="BIKA: Edit Worksheet"/>

<permission id="bika.lims.ImportInstrumentResults" title="BIKA: Import Instrument Results"/>

<permission id="bika.lims.AccessJSONAPI" title="BIKA: Access JSON API"/>

<permission id="bika.lims.ResultsNotRequested" title="BIKA: Results not requested"/>
<permission id="bika.lims.ManageInvoices" title="BIKA: Manage Invoices"/>

<permission id="bika.lims.ViewLogTab" title="BIKA: View Log Tab"/>

# Other:
# ------
<permission id="bika.lims.ViewResults" title="BIKA: View Results"/>
<permission id="bika.lims.EditResults" title="BIKA: Edit Results"/>
# Sampling workflow - allows editing field results while in sample_due state
<permission id="bika.lims.EditFieldResults" title="BIKA: Edit Field Results"/>
# permission to prevent Client Contact from seeing Retracted analyses
<permission id="bika.lims.ViewRetractedAnalyses" title="BIKA: View Retracted Analyses"/>

<permission id="bika.lims.ManageLoginDetails" title="BIKA: Manage Login Details"/>

<permission id="bika.lims.Assign" title="BIKA: Assign analyses"/>
<permission id="bika.lims.Unassign" title="BIKA: Unassign analyses"/>

<!-- Field permissions -->
<permission id="bika.lims.EditARContact" title="BIKA: Edit AR Contact"/>

# Edit AR
# -----------------------------------------------------------------------------
# Allows to set values for AR fields in AR view
#
# Only takes effect if:
#   - The AR's 'cancellation_state' is 'active'
#   - The AR's 'review_state' is in:
#       'sample_registered', 'to_be_sampled', 'sampled', 'to_be_preserved',
#       'sample_due', 'sample_received', 'to_be_verified', 'attachment_due'
<permission id="bika.lims.EditAR" title="BIKA: Edit AR"/>

# Edit Sample Partition
# ----------------------------------------------
# Allows to set a Container and/or Preserver for a Sample Partition
# See AR view: Sample Partitions table and Sample Partitions tab
#
# Only takes effect if:
#   - The Sample's 'cancellation_state' is 'active'
#   - The Sample's 'review_state' is in:
#       'sample_registered', 'to_be_sampled', 'sampled', 'to_be_preserved',
#       'sample_due', 'sample_received', 'to_be_verified', 'attachment_due'
<permission id="bika.lims.EditSamplePartition" title="BIKA: Edit Sample Partition"/>

# Edit Client
# ----------------------------------------------
# Allows access to 'Edit' and 'Contacts' tabs from Client View
<permission id="bika.lims.EditClient" title="BIKA: Edit Client"/>

# Manage Supply Orders
# ----------------------------------------------
# Allows access to 'Supply Orders' tab in Client context
<permission id="bika.lims.ManageSupplyOrders" title="BIKA: Manage Supply Orders"/>

# Batch specific permissions
# ----------------------------------------------
<permission id="bika.lims.EditBatch" title="BIKA: Edit Batch"/>
<permission id="bika.lims.CloseBatch" title="BIKA: Close Batch"/>
<permission id="bika.lims.ReopenBatch" title="BIKA: Reopen Batch"/>

# SamplingRound specific permissions
# ----------------------------------------------
<permission id="bika.lims.CloseSamplingRound" title="BIKA: Close SamplingRound"/>
<permission id="bika.lims.ReopenSamplingRound" title="BIKA: Reopen SamplingRound"/>

</configure>
