Class: Salesforce::Types::ObjectPermissions

Inherits:
Object
  • Object
show all
Includes:
ROXML
Defined in:
lib/mdata/types/ObjectPermissions.rb

Overview

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

Author:

  • Ben Burwell

Instance Method Summary collapse

Instance Method Details

#get_permissionsArray

Get an array of granted permissions

Returns:

  • (Array)

    an array of strings, like [‘allowCreate’, ‘allowRead’]



23
24
25
26
27
28
29
30
31
32
# 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_styleString

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

Returns:

  • (String)

    the granted permissions



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# 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