|
11 | 11 | from ..database import Database |
12 | 12 | from ..filemetadata import FileMetadata |
13 | 13 | from ..project import Project |
14 | | -from . import databasesync, file, folder, permission, remote, util |
| 14 | +from . import databasesync, file, folder, permission, remote, user, util |
15 | 15 |
|
16 | 16 |
|
17 | 17 | def _nop(*args, **kwargs): |
@@ -713,35 +713,35 @@ def delete_permission(self, permission: 'permission.Permission'): |
713 | 713 | if not core.BNRemoteProjectDeletePermission(self._handle, permission._handle): |
714 | 714 | raise RuntimeError(util._last_error()) |
715 | 715 |
|
716 | | - def can_user_view(self, username: str) -> bool: |
| 716 | + def can_user_view(self, user: user.User) -> bool: |
717 | 717 | """ |
718 | 718 | Determine if a user is in any of the view/edit/admin groups |
719 | 719 |
|
720 | | - :param username: Username of user to check |
721 | | - :return: True if they are in any of those groups |
| 720 | + :param user: User to check |
| 721 | + :return: True if the user has view permission (either directly or from a group) |
722 | 722 | :raises: RuntimeError if there was an error |
723 | 723 | """ |
724 | | - return core.BNRemoteProjectCanUserView(self._handle, username) |
| 724 | + return core.BNRemoteProjectCanUserView(self._handle, user._handle) |
725 | 725 |
|
726 | | - def can_user_edit(self, username: str) -> bool: |
| 726 | + def can_user_edit(self, user: user.User) -> bool: |
727 | 727 | """ |
728 | 728 | Determine if a user is in any of the edit/admin groups |
729 | 729 |
|
730 | | - :param username: Username of user to check |
731 | | - :return: True if they are in any of those groups |
| 730 | + :param user: User to check |
| 731 | + :return: True if the user has edit permission (either directly or from a group) |
732 | 732 | :raises: RuntimeError if there was an error |
733 | 733 | """ |
734 | | - return core.BNRemoteProjectCanUserEdit(self._handle, username) |
| 734 | + return core.BNRemoteProjectCanUserEdit(self._handle, user._handle) |
735 | 735 |
|
736 | | - def can_user_admin(self, username: str) -> bool: |
| 736 | + def can_user_admin(self, user: user.User) -> bool: |
737 | 737 | """ |
738 | 738 | Determine if a user is in the admin group |
739 | 739 |
|
740 | | - :param username: Username of user to check |
741 | | - :return: True if they are in any of those groups |
| 740 | + :param user: User to check |
| 741 | + :return: True if the user has admin permission (either directly or from a group) |
742 | 742 | :raises: RuntimeError if there was an error |
743 | 743 | """ |
744 | | - return core.BNRemoteProjectCanUserAdmin(self._handle, username) |
| 744 | + return core.BNRemoteProjectCanUserAdmin(self._handle, user._handle) |
745 | 745 |
|
746 | 746 | def upload_new_file( |
747 | 747 | self, |
|
0 commit comments