xlsx-1.1.4: Simple and incomplete Excel file parser/writer

Safe Haskell | None
Language | Haskell2010

Codec.Xlsx.Types.Protection

Contents

- Lenses

Synopsis

- data SheetProtection = SheetProtection {
  - _sprLegacyPassword :: Maybe LegacyPassword
  - _sprSheet :: Bool
  - _sprAutoFilter :: Bool
  - _sprDeleteColumns :: Bool
  - _sprDeleteRows :: Bool
  - _sprFormatCells :: Bool
  - _sprFormatColumns :: Bool
  - _sprFormatRows :: Bool
  - _sprInsertColumns :: Bool
  - _sprInsertHyperlinks :: Bool
  - _sprInsertRows :: Bool
  - _sprObjects :: Bool
  - _sprPivotTables :: Bool
  - _sprScenarios :: Bool
  - _sprSelectLockedCells :: Bool
  - _sprSelectUnlockedCells :: Bool
  - _sprSort :: Bool
  }
- fullSheetProtection :: SheetProtection
- noSheetProtection :: SheetProtection
- data LegacyPassword
- legacyPassword :: Text -> LegacyPassword
- sprLegacyPassword :: Lens' SheetProtection (Maybe LegacyPassword)
- sprSheet :: Lens' SheetProtection Bool
- sprObjects :: Lens' SheetProtection Bool
- sprScenarios :: Lens' SheetProtection Bool
- sprFormatCells :: Lens' SheetProtection Bool
- sprFormatColumns :: Lens' SheetProtection Bool
- sprFormatRows :: Lens' SheetProtection Bool
- sprInsertColumns :: Lens' SheetProtection Bool
- sprInsertRows :: Lens' SheetProtection Bool
- sprInsertHyperlinks :: Lens' SheetProtection Bool
- sprDeleteColumns :: Lens' SheetProtection Bool
- sprDeleteRows :: Lens' SheetProtection Bool
- sprSelectLockedCells :: Lens' SheetProtection Bool
- sprSort :: Lens' SheetProtection Bool
- sprAutoFilter :: Lens' SheetProtection Bool
- sprPivotTables :: Lens' SheetProtection Bool
- sprSelectUnlockedCells :: Lens' SheetProtection Bool

# Documentation

data SheetProtection Source #

Sheet protection options to enforce and specify that it needs to be protected

TODO: algorithms specified in the spec with hashes, salts and spin counts

See 18.3.1.85 "sheetProtection (Sheet Protection Options)" (p. 1694)

Constructors

SheetProtection |

Fields

- _sprLegacyPassword :: Maybe LegacyPassword

  Specifies the legacy hash of the password required for editing this worksheet.

  See Part 4, 15.3.1.6 "Additional attribute for sheetProtection element (Part 1, §18.3.1.85)" (p. 229)

- _sprSheet :: Bool

  the value of this attribute dictates whether the other attributes of `SheetProtection` should be applied

- _sprAutoFilter :: Bool

  AutoFilters should not be allowed to operate when the sheet is protected

- _sprDeleteColumns :: Bool

  deleting columns should not be allowed when the sheet is protected

- _sprDeleteRows :: Bool

  deleting rows should not be allowed when the sheet is protected

- _sprFormatCells :: Bool

  formatting cells should not be allowed when the sheet is protected

- _sprFormatColumns :: Bool

  formatting columns should not be allowed when the sheet is protected

- _sprFormatRows :: Bool

  formatting rows should not be allowed when the sheet is protected

- _sprInsertColumns :: Bool

  inserting columns should not be allowed when the sheet is protected

- _sprInsertHyperlinks :: Bool

  inserting hyperlinks should not be allowed when the sheet is protected

- _sprInsertRows :: Bool

  inserting rows should not be allowed when the sheet is protected

- _sprObjects :: Bool

  editing of objects should not be allowed when the sheet is protected

- _sprPivotTables :: Bool

  PivotTables should not be allowed to operate when the sheet is protected

- _sprScenarios :: Bool

  Scenarios should not be edited when the sheet is protected

- _sprSelectLockedCells :: Bool

  selection of locked cells should not be allowed when the sheet is protected

- _sprSelectUnlockedCells :: Bool

  selection of unlocked cells should not be allowed when the sheet is protected

- _sprSort :: Bool

  sorting should not be allowed when the sheet is protected

#### Instances

Instances details

NFData SheetProtection Source # |
Instance details Defined in Codec.Xlsx.Types.Protection Methods rnf :: SheetProtection -> () Source #
Generic SheetProtection Source # |

Instance details

Defined in Codec.Xlsx.Types.Protection

Associated Types

type Rep SheetProtection |

Instance details

Defined in Codec.Xlsx.Types.Protection

type Rep SheetProtection = D1 ('MetaData "SheetProtection" "Codec.Xlsx.Types.Protection" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'False) (C1 ('MetaCons "SheetProtection" 'PrefixI 'True) ((((S1 ('MetaSel ('Just "_sprLegacyPassword") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe LegacyPassword)) :*: S1 ('MetaSel ('Just "_sprSheet") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "_sprAutoFilter") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprDeleteColumns") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "_sprDeleteRows") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprFormatCells") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "_sprFormatColumns") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprFormatRows") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))) :*: (((S1 ('MetaSel ('Just "_sprInsertColumns") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprInsertHyperlinks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "_sprInsertRows") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprObjects") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "_sprPivotTables") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprScenarios") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "_sprSelectLockedCells") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "_sprSelectUnlockedCells") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprSort") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))))))

Methods

from :: SheetProtection -> Rep SheetProtection x Source #

to :: Rep SheetProtection x -> SheetProtection Source #

Show SheetProtection Source # |
Instance details Defined in Codec.Xlsx.Types.Protection Methods showsPrec :: Int -> SheetProtection -> ShowS Source # show :: SheetProtection -> String Source # showList :: [SheetProtection] -> ShowS Source #
Eq SheetProtection Source # |
Instance details Defined in Codec.Xlsx.Types.Protection Methods (==) :: SheetProtection -> SheetProtection -> Bool Source # (/=) :: SheetProtection -> SheetProtection -> Bool Source #
FromCursor SheetProtection Source # |
Instance details Defined in Codec.Xlsx.Types.Protection Methods fromCursor :: Cursor -> [SheetProtection] Source #
FromXenoNode SheetProtection Source # |
Instance details Defined in Codec.Xlsx.Types.Protection Methods fromXenoNode :: Node -> Either Text SheetProtection Source #
ToElement SheetProtection Source # |
Instance details Defined in Codec.Xlsx.Types.Protection Methods toElement :: Name -> SheetProtection -> Element Source #
type Rep SheetProtection Source # |

Instance details

Defined in Codec.Xlsx.Types.Protection

type Rep SheetProtection = D1 ('MetaData "SheetProtection" "Codec.Xlsx.Types.Protection" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'False) (C1 ('MetaCons "SheetProtection" 'PrefixI 'True) ((((S1 ('MetaSel ('Just "_sprLegacyPassword") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe LegacyPassword)) :*: S1 ('MetaSel ('Just "_sprSheet") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "_sprAutoFilter") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprDeleteColumns") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "_sprDeleteRows") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprFormatCells") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "_sprFormatColumns") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprFormatRows") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))) :*: (((S1 ('MetaSel ('Just "_sprInsertColumns") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprInsertHyperlinks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "_sprInsertRows") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprObjects") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "_sprPivotTables") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprScenarios") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "_sprSelectLockedCells") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "_sprSelectUnlockedCells") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sprSort") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))))))

fullSheetProtection :: SheetProtection Source #

protection of all sheet features which could be protected

noSheetProtection :: SheetProtection Source #

no sheet protection at all

data LegacyPassword Source #

#### Instances

Instances details

NFData LegacyPassword Source # |
Instance details Defined in Codec.Xlsx.Types.Protection Methods rnf :: LegacyPassword -> () Source #
Generic LegacyPassword Source # |

Instance details

Defined in Codec.Xlsx.Types.Protection

Associated Types

type Rep LegacyPassword |
Instance details Defined in Codec.Xlsx.Types.Protection type Rep LegacyPassword = D1 ('MetaData "LegacyPassword" "Codec.Xlsx.Types.Protection" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'True) (C1 ('MetaCons "LegacyPassword" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

Methods

from :: LegacyPassword -> Rep LegacyPassword x Source #

to :: Rep LegacyPassword x -> LegacyPassword Source #

Show LegacyPassword Source # |
Instance details Defined in Codec.Xlsx.Types.Protection Methods showsPrec :: Int -> LegacyPassword -> ShowS Source # show :: LegacyPassword -> String Source # showList :: [LegacyPassword] -> ShowS Source #
Eq LegacyPassword Source # |
Instance details Defined in Codec.Xlsx.Types.Protection Methods (==) :: LegacyPassword -> LegacyPassword -> Bool Source # (/=) :: LegacyPassword -> LegacyPassword -> Bool Source #
FromAttrVal LegacyPassword Source # |
Instance details Defined in Codec.Xlsx.Types.Protection Methods fromAttrVal :: Reader LegacyPassword Source #
FromAttrBs LegacyPassword Source # |
Instance details Defined in Codec.Xlsx.Types.Protection Methods fromAttrBs :: ByteString -> Either Text LegacyPassword Source #
ToAttrVal LegacyPassword Source # |
Instance details Defined in Codec.Xlsx.Types.Protection Methods toAttrVal :: LegacyPassword -> Text Source #
type Rep LegacyPassword Source # |
Instance details Defined in Codec.Xlsx.Types.Protection type Rep LegacyPassword = D1 ('MetaData "LegacyPassword" "Codec.Xlsx.Types.Protection" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'True) (C1 ('MetaCons "LegacyPassword" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

legacyPassword :: Text -> LegacyPassword Source #

Creates legacy `XOR` hashed password.

Note: The implementation is known to work only for ASCII symbols, if you know how to encode properly others - an email or a PR will be highly apperciated

See Part 4, 14.7.1 "Legacy Password Hash Algorithm" (p. 73) and Part 4, 15.2.3 "Additional attributes for workbookProtection element (Part 1, §18.2.29)" (p. 220) and Par 4, 15.3.1.6 "Additional attribute for sheetProtection element (Part 1, §18.3.1.85)" (p. 229)

# Lenses

sprLegacyPassword :: Lens' SheetProtection (Maybe LegacyPassword) Source #

sprSheet :: Lens' SheetProtection Bool Source #

sprObjects :: Lens' SheetProtection Bool Source #

sprScenarios :: Lens' SheetProtection Bool Source #

sprFormatCells :: Lens' SheetProtection Bool Source #

sprFormatColumns :: Lens' SheetProtection Bool Source #

sprFormatRows :: Lens' SheetProtection Bool Source #

sprInsertColumns :: Lens' SheetProtection Bool Source #

sprInsertRows :: Lens' SheetProtection Bool Source #

sprInsertHyperlinks :: Lens' SheetProtection Bool Source #

sprDeleteColumns :: Lens' SheetProtection Bool Source #

sprDeleteRows :: Lens' SheetProtection Bool Source #

sprSelectLockedCells :: Lens' SheetProtection Bool Source #

sprSort :: Lens' SheetProtection Bool Source #

sprAutoFilter :: Lens' SheetProtection Bool Source #

sprPivotTables :: Lens' SheetProtection Bool Source #

sprSelectUnlockedCells :: Lens' SheetProtection Bool Source #