@@ 1138-1161 (lines=24) @@ | ||
1135 | if comment: |
|
1136 | cmd.add_element("comment", comment) |
|
1137 | ||
1138 | if resource_id or resource_type: |
|
1139 | if not resource_id: |
|
1140 | raise RequiredArgument( |
|
1141 | function=self.create_permission.__name__, |
|
1142 | argument='resource_id', |
|
1143 | ) |
|
1144 | ||
1145 | if not resource_type: |
|
1146 | raise RequiredArgument( |
|
1147 | function=self.create_permission.__name__, |
|
1148 | argument='resource_type', |
|
1149 | ) |
|
1150 | ||
1151 | if not isinstance(resource_type, self.types.EntityType): |
|
1152 | raise InvalidArgumentType( |
|
1153 | function=self.create_permission.__name__, |
|
1154 | argument='resource_type', |
|
1155 | arg_type=self.types.EntityType.__name__, |
|
1156 | ) |
|
1157 | ||
1158 | _xmlresource = cmd.add_element( |
|
1159 | "resource", attrs={"id": resource_id} |
|
1160 | ) |
|
1161 | _xmlresource.add_element("type", resource_type.value) |
|
1162 | ||
1163 | return self._send_xml_command(cmd) |
|
1164 | ||
@@ 5181-5204 (lines=24) @@ | ||
5178 | if name: |
|
5179 | cmd.add_element("name", name) |
|
5180 | ||
5181 | if resource_id or resource_type: |
|
5182 | if not resource_id: |
|
5183 | raise RequiredArgument( |
|
5184 | function=self.modify_permission.__name__, |
|
5185 | argument='resource_id', |
|
5186 | ) |
|
5187 | ||
5188 | if not resource_type: |
|
5189 | raise RequiredArgument( |
|
5190 | function=self.modify_permission.__name__, |
|
5191 | argument='resource_type', |
|
5192 | ) |
|
5193 | ||
5194 | if not isinstance(resource_type, self.types.EntityType): |
|
5195 | raise InvalidArgumentType( |
|
5196 | function=self.modify_permission.__name__, |
|
5197 | argument='resource_type', |
|
5198 | arg_type=self.types.EntityType.__name__, |
|
5199 | ) |
|
5200 | ||
5201 | _xmlresource = cmd.add_element( |
|
5202 | "resource", attrs={"id": resource_id} |
|
5203 | ) |
|
5204 | _xmlresource.add_element("type", resource_type.value) |
|
5205 | ||
5206 | if subject_id or subject_type: |
|
5207 | if not subject_id: |
|
@@ 5693-5714 (lines=22) @@ | ||
5690 | if active is not None: |
|
5691 | cmd.add_element("active", _to_bool(active)) |
|
5692 | ||
5693 | if resource_id or resource_type: |
|
5694 | if not resource_id: |
|
5695 | raise RequiredArgument( |
|
5696 | function=self.modify_tag.__name__, argument='resource_id' |
|
5697 | ) |
|
5698 | ||
5699 | if not resource_type: |
|
5700 | raise RequiredArgument( |
|
5701 | function=self.modify_tag.__name__, argument='resource_type' |
|
5702 | ) |
|
5703 | ||
5704 | if not isinstance(resource_type, self.types.EntityType): |
|
5705 | raise InvalidArgumentType( |
|
5706 | function=self.modify_tag.__name__, |
|
5707 | argument='resource_type', |
|
5708 | arg_type=self.types.EntityType.__name__, |
|
5709 | ) |
|
5710 | ||
5711 | _xmlresource = cmd.add_element( |
|
5712 | "resource", attrs={"id": resource_id} |
|
5713 | ) |
|
5714 | _xmlresource.add_element("type", resource_type.value) |
|
5715 | ||
5716 | return self._send_xml_command(cmd) |
|
5717 |