@@ 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 |
@@ 3388-3426 (lines=39) @@ | ||
3385 | cmd.add_element("copy", filter_id) |
|
3386 | return self._send_xml_command(cmd) |
|
3387 | ||
3388 | def create_group( |
|
3389 | self, |
|
3390 | name: str, |
|
3391 | *, |
|
3392 | comment: Optional[str] = None, |
|
3393 | special: Optional[bool] = False, |
|
3394 | users: Optional[List[str]] = None, |
|
3395 | ) -> Any: |
|
3396 | """Create a new group |
|
3397 | ||
3398 | Arguments: |
|
3399 | name: Name of the new group |
|
3400 | comment: Comment for the group |
|
3401 | special: Create permission giving members full access to each |
|
3402 | other's entities |
|
3403 | users: List of user names to be in the group |
|
3404 | ||
3405 | Returns: |
|
3406 | The response. See :py:meth:`send_command` for details. |
|
3407 | """ |
|
3408 | if not name: |
|
3409 | raise RequiredArgument( |
|
3410 | function=self.create_group.__name__, argument='name' |
|
3411 | ) |
|
3412 | ||
3413 | cmd = XmlCommand("create_group") |
|
3414 | cmd.add_element("name", name) |
|
3415 | ||
3416 | if comment: |
|
3417 | cmd.add_element("comment", comment) |
|
3418 | ||
3419 | if special: |
|
3420 | _xmlspecial = cmd.add_element("specials") |
|
3421 | _xmlspecial.add_element("full") |
|
3422 | ||
3423 | if users: |
|
3424 | cmd.add_element("users", _to_comma_list(users)) |
|
3425 | ||
3426 | return self._send_xml_command(cmd) |
|
3427 | ||
3428 | def clone_group(self, group_id: str) -> Any: |
|
3429 | """Clone an existing group |