Class: MicrosoftGraph::Models::RoleDefinition

Inherits:
Entity
  • Object
show all
Includes:
MicrosoftKiotaAbstractions::Parsable
Defined in:
lib/models/role_definition.rb

Overview

The Role Definition resource. The role definition is the foundation of role based access in Intune. The role combines an Intune resource such as a Mobile App and associated role permissions such as Create or Read for the resource. There are two types of roles, built-in and custom. Built-in roles cannot be modified. Both built-in roles and custom roles must have assignments to be enforced. Create custom roles if you want to define a role that allows any of the available resources and role permissions to be combined into a single role.

Direct Known Subclasses

DeviceAndAppManagementRoleDefinition

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#additional_data, #additional_data=, #id, #id=, #odata_type, #odata_type=

Constructor Details

#initializeObject

Instantiates a new roleDefinition and sets the default values.



30
31
32
# File 'lib/models/role_definition.rb', line 30

def initialize()
    super
end

Class Method Details

.create_from_discriminator_value(parse_node) ⇒ Object

Creates a new instance of the appropriate class based on discriminator value

Parameters:

  • parse_node

    The parse node to use to read the discriminator value and create the object

Returns:

  • a role_definition

Raises:

  • (StandardError)


38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/models/role_definition.rb', line 38

def self.create_from_discriminator_value(parse_node)
    raise StandardError, 'parse_node cannot be null' if parse_node.nil?
    mapping_value_node = parse_node.get_child_node("@odata.type")
    unless mapping_value_node.nil? then
        mapping_value = mapping_value_node.get_string_value
        case mapping_value
            when "#microsoft.graph.deviceAndAppManagementRoleDefinition"
                return DeviceAndAppManagementRoleDefinition.new
        end
    end
    return RoleDefinition.new
end

Instance Method Details

#descriptionObject

Gets the description property value. Description of the Role definition.

Returns:

  • a string



54
55
56
# File 'lib/models/role_definition.rb', line 54

def description
    return @description
end

#description=(value) ⇒ Object

Sets the description property value. Description of the Role definition.

Parameters:

  • value

    Value to set for the description property.

Returns:

  • a void



62
63
64
# File 'lib/models/role_definition.rb', line 62

def description=(value)
    @description = value
end

#display_nameObject

Gets the displayName property value. Display Name of the Role definition.

Returns:

  • a string



69
70
71
# File 'lib/models/role_definition.rb', line 69

def display_name
    return @display_name
end

#display_name=(value) ⇒ Object

Sets the displayName property value. Display Name of the Role definition.

Parameters:

  • value

    Value to set for the displayName property.

Returns:

  • a void



77
78
79
# File 'lib/models/role_definition.rb', line 77

def display_name=(value)
    @display_name = value
end

#get_field_deserializersObject

The deserialization information for the current model

Returns:

  • a i_dictionary



84
85
86
87
88
89
90
91
92
# File 'lib/models/role_definition.rb', line 84

def get_field_deserializers()
    return super.merge({
        "description" => lambda {|n| @description = n.get_string_value() },
        "displayName" => lambda {|n| @display_name = n.get_string_value() },
        "isBuiltIn" => lambda {|n| @is_built_in = n.get_boolean_value() },
        "roleAssignments" => lambda {|n| @role_assignments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RoleAssignment.create_from_discriminator_value(pn) }) },
        "rolePermissions" => lambda {|n| @role_permissions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RolePermission.create_from_discriminator_value(pn) }) },
    })
end

#is_built_inObject

Gets the isBuiltIn property value. Type of Role. Set to True if it is built-in, or set to False if it is a custom role definition.

Returns:

  • a boolean



97
98
99
# File 'lib/models/role_definition.rb', line 97

def is_built_in
    return @is_built_in
end

#is_built_in=(value) ⇒ Object

Sets the isBuiltIn property value. Type of Role. Set to True if it is built-in, or set to False if it is a custom role definition.

Parameters:

  • value

    Value to set for the isBuiltIn property.

Returns:

  • a void



105
106
107
# File 'lib/models/role_definition.rb', line 105

def is_built_in=(value)
    @is_built_in = value
end

#role_assignmentsObject

Gets the roleAssignments property value. List of Role assignments for this role definition.

Returns:

  • a role_assignment



112
113
114
# File 'lib/models/role_definition.rb', line 112

def role_assignments
    return @role_assignments
end

#role_assignments=(value) ⇒ Object

Sets the roleAssignments property value. List of Role assignments for this role definition.

Parameters:

  • value

    Value to set for the roleAssignments property.

Returns:

  • a void



120
121
122
# File 'lib/models/role_definition.rb', line 120

def role_assignments=(value)
    @role_assignments = value
end

#role_permissionsObject

Gets the rolePermissions property value. List of Role Permissions this role is allowed to perform. These must match the actionName that is defined as part of the rolePermission.

Returns:

  • a role_permission



127
128
129
# File 'lib/models/role_definition.rb', line 127

def role_permissions
    return @role_permissions
end

#role_permissions=(value) ⇒ Object

Sets the rolePermissions property value. List of Role Permissions this role is allowed to perform. These must match the actionName that is defined as part of the rolePermission.

Parameters:

  • value

    Value to set for the rolePermissions property.

Returns:

  • a void



135
136
137
# File 'lib/models/role_definition.rb', line 135

def role_permissions=(value)
    @role_permissions = value
end

#serialize(writer) ⇒ Object

Serializes information the current object

Parameters:

  • writer

    Serialization writer to use to serialize this model

Returns:

  • a void

Raises:

  • (StandardError)


143
144
145
146
147
148
149
150
151
# File 'lib/models/role_definition.rb', line 143

def serialize(writer)
    raise StandardError, 'writer cannot be null' if writer.nil?
    super
    writer.write_string_value("description", @description)
    writer.write_string_value("displayName", @display_name)
    writer.write_boolean_value("isBuiltIn", @is_built_in)
    writer.write_collection_of_object_values("roleAssignments", @role_assignments)
    writer.write_collection_of_object_values("rolePermissions", @role_permissions)
end