Show More
@@ -59,3 +59,46 b' exit the ishell after the execution::' | |||
|
59 | 59 | |
|
60 | 60 | echo "%run repo_delete_task.py" | rccontrol ishell enterprise-1 |
|
61 | 61 | |
|
62 | ||
|
63 | ||
|
64 | ||
|
65 | Bulk edit permissions for all repositories or groups | |
|
66 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
|
67 | ||
|
68 | In case when a permissions should be applied in bulk here are two ways to apply | |
|
69 | the permissions onto *all* repositories and/or repository groups. | |
|
70 | ||
|
71 | 1) Start by running the interactive ishell interface | |
|
72 | ||
|
73 | .. code-block:: bash | |
|
74 | :dedent: 1 | |
|
75 | ||
|
76 | # starts the ishell interactive prompt | |
|
77 | $ rccontrol ishell enterprise-1 | |
|
78 | ||
|
79 | ||
|
80 | 2a) Add user called 'admin' into all repositories with write permission. | |
|
81 | Permissions can be also `repository.read`, `repository.admin`, `repository.none` | |
|
82 | ||
|
83 | .. code-block:: python | |
|
84 | :dedent: 1 | |
|
85 | ||
|
86 | In [1]: from rhodecode.model.repo import RepoModel | |
|
87 | In [2]: user = User.get_by_username('admin') | |
|
88 | In [3]: permission_name = 'repository.write' | |
|
89 | In [4]: for repo in Repository.get_all(): | |
|
90 | ...: RepoModel().grant_user_permission(repo, user, permission_name) | |
|
91 | ...: Session().commit() | |
|
92 | ||
|
93 | 2b) Add user called 'admin' into all repository groups with write permission. | |
|
94 | Permissions can be also can be `group.read`, `group.admin`, `group.none` | |
|
95 | ||
|
96 | .. code-block:: python | |
|
97 | :dedent: 1 | |
|
98 | ||
|
99 | In [1]: from rhodecode.model.repo import RepoModel | |
|
100 | In [2]: user = User.get_by_username('admin') | |
|
101 | In [3]: permission_name = 'group.write' | |
|
102 | In [4]: for repo_group in RepoGroup.get_all(): | |
|
103 | ...: RepoGroupModel().grant_user_permission(repo_group, user, permission_name) | |
|
104 | ...: Session().commit() No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now