Interface IPermission

  • All Known Implementing Classes:
    Permission

    public interface IPermission
    Represents the permissions of a set of subjects.

    The permissioning system can control read and write access to subjects selected by the specified SubjectPattern.

    Within the Caplin Xaqua environment there is a dedicated trade channel (subject) per asset class, for each user. If the trade channel subject is within the ^/TRADE/FX namespace and you wish to permit trading for the user on subjects within the ^/FX/ namespace, then the permissions should be configured as follows:

    SubjectPattern ReadAllowed WriteAllowed TradeAllowed InstrumentField
    ^/TRADE/FX true true false Instrument
    ^/FX true false true null

    This example shows how to add permissions so that trading is permitted on the ^/FX namespace.

    public class ExampleFXTradingPermissions
    {
            public IUserPermissions createStandardFXPermissions()
            {
                    // Create an empty permission set.
                    IUserPermissions userPerms = new UserPermissions();
                    
                    // Add in read and trading access for FX
                    userPerms.addPermission(new Permission("^/FX", true, false, true));
                    
                    // Now add in permissions for the trade channel.
                    // For trading to work, the StreamLink client should contribute a field called "TradingInstrument"
                    // containing a subject under /FX
                    // When using a trade channel subject, the subject must have read and write permissions.
                    userPerms.addPermission(new Permission("^/TRADE/FX", true, true, false, "TradingInstrument"));
                    
                    return userPerms;
            }
    }
    

    • Method Detail

      • getSubjectPattern

        java.lang.String getSubjectPattern()
        Gets the regular expression representing the subjects that should have the permissions defined by this IPermission.

        The regular expression syntaxes supported by the Liberator are Basic and Extended. The full Java regular expressions syntax is not supported. However, the syntax for the most common regular expression operations is the same in each case. For more information on the various regular expression syntaxes, see www .regular-expressions.info.

        Returns:
        The regular expression.
      • setSubjectPattern

        void setSubjectPattern​(java.lang.String value)
        Sets the regular expression representing the subjects that should have the permissions defined by this IPermission.

        The regular expression syntaxes supported by the Liberator are Basic and Extended. The full Java regular expressions syntax is not supported. However, the syntax for the most common regular expression operations is the same in each case. For more information on the various regular expression syntaxes, see www .regular-expressions.info.

        Parameters:
        value - the subject pattern to set.
      • getReadAllowed

        boolean getReadAllowed()
        Gets a value indicating whether the user can read subjects matching getSubjectPattern()
        Returns:
        true if reading is allowed, otherwise false.
      • setReadAllowed

        void setReadAllowed​(boolean readAllowed)
        Sets a value indicating whether the user can read subjects matching getSubjectPattern()
        Parameters:
        readAllowed - boolean indicating if read is allowed.
      • getWriteAllowed

        boolean getWriteAllowed()
        Gets a value indicating whether the user can contribute to (publish to) subjects matching getSubjectPattern().
        Returns:
        true if contributing is allowed, otherwise false.
      • setWriteAllowed

        void setWriteAllowed​(boolean writeAllowed)
        Sets a value indicating whether the user can contribute to (publish to) subjects matching getSubjectPattern().
        Parameters:
        writeAllowed - boolean value indicating if write is allowed.
      • getTradeAllowed

        boolean getTradeAllowed()
        Gets a value indicating whether the user can trade on subjects matching getSubjectPattern().
        Returns:
        true if trading is allowed, otherwise false
      • setTradeAllowed

        void setTradeAllowed​(boolean tradeAllowed)
        Sets a value indicating whether the user can trade on subjects matching getSubjectPattern().
        Parameters:
        tradeAllowed - boolean value indicating if trading is allowed.
      • getInstrumentField

        java.lang.String getInstrumentField()
        Gets the instrument field.

        The instrument field must be present on StreamLink contributions to trade channels. It contains the name of a field specifying the name of an instrument that can be traded.

        The default value of null implies that the field is not defined.

        Returns:
        The instrument field.
      • setInstrumentField

        void setInstrumentField​(java.lang.String instrumentField)
        Sets the instrument field.

        The instrument field must be present on StreamLink contributions to trade channels. It contains the name of a field specifying the name of an instrument that can be traded.

        The default value of null implies that the field is not defined.

        Parameters:
        instrumentField - the instrument field.