/php/component/revoker.class.php
https://bitbucket.org/chamilo/chamilo-ext-repo-bitbucket-dev/ · PHP · 51 lines · 45 code · 6 blank · 0 comment · 8 complexity · c9dc54536e7fe78afccba6230e17a529 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 BitbucketExternalRepositoryManagerRevokerComponent extends BitbucketExternalRepositoryManager
- {
-
- function run()
- {
- $id = Request :: get(self :: PARAM_EXTERNAL_REPOSITORY_ID);
- $user = Request :: get(self :: PARAM_EXTERNAL_REPOSITORY_USER);
- $group = Request :: get(self :: PARAM_EXTERNAL_REPOSITORY_GROUP);
- if ($id || ($id && $user) || ($id && $group))
- {
- if (! $user && ! $group)
- {
- $success = $this->get_external_repository_manager_connector()->revoke_user_privilege($id);
- $success = $this->get_external_repository_manager_connector()->revoke_group_privilege($id);
- }
- elseif ($user)
- {
- $success = $this->get_external_repository_manager_connector()->revoke_user_privilege($id, $user);
- }
- elseif ($group)
- {
- $success = $this->get_external_repository_manager_connector()->revoke_group_privilege($id, $group);
-
- }
- 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;
- $this->redirect(Translation :: get('PrivilegesRevoked'), 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('PrivilegesNotRevoked'), true, $parameters);
- }
- }
-
- }
- }
-
- ?>