@@ 3356-3394 (lines=39) @@ | ||
3353 | cmd.add_element("copy", filter_id) |
|
3354 | return self._send_xml_command(cmd) |
|
3355 | ||
3356 | def create_group( |
|
3357 | self, |
|
3358 | name: str, |
|
3359 | *, |
|
3360 | comment: Optional[str] = None, |
|
3361 | special: Optional[bool] = False, |
|
3362 | users: Optional[List[str]] = None, |
|
3363 | ) -> Any: |
|
3364 | """Create a new group |
|
3365 | ||
3366 | Arguments: |
|
3367 | name: Name of the new group |
|
3368 | comment: Comment for the group |
|
3369 | special: Create permission giving members full access to each |
|
3370 | other's entities |
|
3371 | users: List of user names to be in the group |
|
3372 | ||
3373 | Returns: |
|
3374 | The response. See :py:meth:`send_command` for details. |
|
3375 | """ |
|
3376 | if not name: |
|
3377 | raise RequiredArgument( |
|
3378 | function=self.create_group.__name__, argument='name' |
|
3379 | ) |
|
3380 | ||
3381 | cmd = XmlCommand("create_group") |
|
3382 | cmd.add_element("name", name) |
|
3383 | ||
3384 | if comment: |
|
3385 | cmd.add_element("comment", comment) |
|
3386 | ||
3387 | if special: |
|
3388 | _xmlspecial = cmd.add_element("specials") |
|
3389 | _xmlspecial.add_element("full") |
|
3390 | ||
3391 | if users: |
|
3392 | cmd.add_element("users", _to_comma_list(users)) |
|
3393 | ||
3394 | return self._send_xml_command(cmd) |
|
3395 | ||
3396 | def clone_group(self, group_id: str) -> Any: |
|
3397 | """Clone an existing group |
@@ 807-845 (lines=39) @@ | ||
804 | cmd.add_element("copy", filter_id) |
|
805 | return self._send_xml_command(cmd) |
|
806 | ||
807 | def create_group( |
|
808 | self, |
|
809 | name: str, |
|
810 | *, |
|
811 | comment: Optional[str] = None, |
|
812 | special: Optional[bool] = False, |
|
813 | users: Optional[List[str]] = None, |
|
814 | ) -> Any: |
|
815 | """Create a new group |
|
816 | ||
817 | Arguments: |
|
818 | name: Name of the new group |
|
819 | comment: Comment for the group |
|
820 | special: Create permission giving members full access to each |
|
821 | other's entities |
|
822 | users: List of user names to be in the group |
|
823 | ||
824 | Returns: |
|
825 | The response. See :py:meth:`send_command` for details. |
|
826 | """ |
|
827 | if not name: |
|
828 | raise RequiredArgument( |
|
829 | function=self.create_group.__name__, argument='name' |
|
830 | ) |
|
831 | ||
832 | cmd = XmlCommand("create_group") |
|
833 | cmd.add_element("name", name) |
|
834 | ||
835 | if comment: |
|
836 | cmd.add_element("comment", comment) |
|
837 | ||
838 | if special: |
|
839 | _xmlspecial = cmd.add_element("specials") |
|
840 | _xmlspecial.add_element("full") |
|
841 | ||
842 | if users: |
|
843 | cmd.add_element("users", _to_comma_list(users)) |
|
844 | ||
845 | return self._send_xml_command(cmd) |
|
846 | ||
847 | def clone_group(self, group_id: str) -> Any: |
|
848 | """Clone an existing group |