/php/component/granter.class.php
https://bitbucket.org/chamilo/chamilo-ext-repo-bitbucket-dev/ · PHP · 44 lines · 38 code · 6 blank · 0 comment · 5 complexity · 1ee764b520d3b34432b284381512ac94 MD5 · raw file
- <?php
- namespace common\extensions\external_repository_manager\implementation\bitbucket;
-
- use common\extensions\external_repository_manager\ExternalRepositoryComponent;
- use common\libraries\Request;
- use common\libraries\Translation;
-
- class BitbucketExternalRepositoryManagerGranterComponent extends BitbucketExternalRepositoryManager
- {
-
- function run()
- {
- $id = Request :: get(self :: PARAM_EXTERNAL_REPOSITORY_ID);
- $user = Request :: get(self :: PARAM_EXTERNAL_REPOSITORY_USER);
-
- $privilege = Request :: get(self :: PARAM_EXTERNAL_REPOSITORY_PRIVILEGE);
-
- if ($id || ($id && $user && $privilege))
- {
- $success = $this->get_external_repository_manager_connector()->grant_user_privilege($id, $user, $privilege);
- if ($success)
- {
- $parameters = $this->get_parameters();
- $parameters[self :: PARAM_EXTERNAL_REPOSITORY_MANAGER_ACTION] = self :: ACTION_VIEW_EXTERNAL_REPOSITORY_PRIVILEGES;
- $parameters[self :: PARAM_EXTERNAL_REPOSITORY_ID] = $id;
- $parameters[self :: PARAM_EXTERNAL_REPOSITORY_USER] = $user;
- $parameters[self :: PARAM_EXTERNAL_REPOSITORY_PRIVILEGE] = $privilege;
- $this->redirect(Translation :: get('PrivilegesGranted'), false, $parameters);
- }
- else
- {
- $parameters = $this->get_parameters();
- $parameters[self :: PARAM_EXTERNAL_REPOSITORY_MANAGER_ACTION] = self :: ACTION_VIEW_EXTERNAL_REPOSITORY_PRIVILEGES;
- $parameters[self :: PARAM_EXTERNAL_REPOSITORY_ID] = $id;
- $this->redirect(Translation :: get('PrivilegesNotGranted'), true, $parameters);
- }
- }
- else
- {
-
- }
- }
- }
- ?>