class Salesforce::Types::ObjectPermissions

A generic ObjectPermissions class that can be extended for specific metadata objects, e.g. ProfileObjectPermissions.

@author Ben Burwell

Public Instance Methods

get_permissions() click to toggle source

Get an array of granted permissions

@return [Array] an array of strings, like ['allowCreate', 'allowRead']

# File lib/mdata/types/ObjectPermissions.rb, line 23
def get_permissions
        permissions = []
        permissions.push 'allowCreate' if @allowCreate == 'true'
        permissions.push 'allowDelete' if @allowDelete == 'true'
        permissions.push 'allowEdit' if @allowEdit == 'true'
        permissions.push 'allowRead' if @allowRead == 'true'
        permissions.push 'modifyAllRecords' if @modifyAllRecords == 'true'
        permissions.push 'viewAllRecords' if @viewAllRecords == 'true'
        permissions
end
to_flag_style() click to toggle source

A Unix flag style representation of the permissions, suitable for printing in a table

@return [String] the granted permissions

# File lib/mdata/types/ObjectPermissions.rb, line 38
def to_flag_style
        permissions = ''

        if @allowCreate == 'true'
                permissions += 'allowCreate '
        else
                permissions += '            '
        end

        if @allowDelete == 'true'
                permissions += 'allowDelete '
        else
                permissions += '            '
        end

        if @allowEdit == 'true'
                permissions += 'allowEdit '
        else
                permissions += '          '
        end

        if @allowRead == 'true'
                permissions += 'allowRead '
        else
                permissions += '          '
        end

        if @modifyAllRecords == 'true'
                permissions += 'modifyAllRecords '
        else
                permissions += '                 '
        end

        if @viewAllRecords == 'true'
                permissions += 'viewAllRecords'
        else
                permissions += '              '
        end

        permissions
end