PageRenderTime 22ms CodeModel.GetById 18ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/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
 1<?php
 2namespace common\extensions\external_repository_manager\implementation\bitbucket;
 3
 4use common\extensions\external_repository_manager\ExternalRepositoryComponent;
 5use common\libraries\Request;
 6use common\libraries\Translation;
 7
 8class BitbucketExternalRepositoryManagerGranterComponent extends BitbucketExternalRepositoryManager
 9{
10
11    function run()
12    {
13        $id = Request :: get(self :: PARAM_EXTERNAL_REPOSITORY_ID);
14        $user = Request :: get(self :: PARAM_EXTERNAL_REPOSITORY_USER);
15        
16        $privilege = Request :: get(self :: PARAM_EXTERNAL_REPOSITORY_PRIVILEGE);
17        
18        if ($id || ($id && $user && $privilege))
19        {
20            $success = $this->get_external_repository_manager_connector()->grant_user_privilege($id, $user, $privilege);
21            if ($success)
22            {
23                $parameters = $this->get_parameters();
24                $parameters[self :: PARAM_EXTERNAL_REPOSITORY_MANAGER_ACTION] = self :: ACTION_VIEW_EXTERNAL_REPOSITORY_PRIVILEGES;
25                $parameters[self :: PARAM_EXTERNAL_REPOSITORY_ID] = $id;
26                $parameters[self :: PARAM_EXTERNAL_REPOSITORY_USER] = $user;
27                $parameters[self :: PARAM_EXTERNAL_REPOSITORY_PRIVILEGE] = $privilege;
28                $this->redirect(Translation :: get('PrivilegesGranted'), false, $parameters);
29            }
30            else
31            {
32                $parameters = $this->get_parameters();
33                $parameters[self :: PARAM_EXTERNAL_REPOSITORY_MANAGER_ACTION] = self :: ACTION_VIEW_EXTERNAL_REPOSITORY_PRIVILEGES;
34                $parameters[self :: PARAM_EXTERNAL_REPOSITORY_ID] = $id;
35                $this->redirect(Translation :: get('PrivilegesNotGranted'), true, $parameters);
36            }
37        }
38        else
39        {
40        
41        }
42    }
43}
44?>