noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 08/09: Add function to grant or revoke admin


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 08/09: Add function to grant or revoke admin to a folder
Date: Thu, 11 Feb 2016 15:17:53 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit 2d984a6bac92443737d0e84e4b951a9738914a70
Author: Dany De Bontridder <address@hidden>
Date:   Thu Feb 11 16:03:12 2016 +0100

    Add function to grant or revoke admin to a folder
---
 include/class/class_dossier.php               |    9 +-
 include/class/class_user.php                  |   68 +++
 unit-test/include/class/class_dossierTest.php |  233 +++++++++
 unit-test/include/class/class_userTest.php    |  620 +++++++++++++++++++++++++
 4 files changed, 922 insertions(+), 8 deletions(-)

diff --git a/include/class/class_dossier.php b/include/class/class_dossier.php
index 9d6944d..8f844bb 100644
--- a/include/class/class_dossier.php
+++ b/include/class/class_dossier.php
@@ -316,14 +316,7 @@ class Dossier
             $cn->start();
             for ($i=0; $i<count($a_admin); $i++)
             {
-                $exist=$cn->get_value("select p_id from profile_user
-                                       where user_name=$1",
-                                    array($a_admin[$i]['use_login']));
-                if ($exist=="")
-                {
-                    $cn->exec_sql("insert into profile_user(user_name,p_id) 
values($1,1)",
-                            array($a_admin[$i]['use_login']));
-                }
+                User::grant_admin_access($a_admin[$i]['use_login'], $p_id);
             }
             $cn->commit();
         }
diff --git a/include/class/class_user.php b/include/class/class_user.php
index a3e1e01..c18fe03 100644
--- a/include/class/class_user.php
+++ b/include/class/class_user.php
@@ -1247,6 +1247,74 @@ class User
         $repo=new Database();
         $repo->exec_sql("update ac_users set use_email=$1 where use_login=$2", 
array($p_email, $_SESSION['g_user']));
     }
+    /**
+     * Remove a user and all his privileges
+     * So it cannot connect anymore and all his privileges are removed from
+     * the dossier
+     * 
+     */
+    static function revoke_access($p_login,$p_dossier) {
+        // connect to the repository
+        $repo_cnx=new Database();
+        
+        // Retrieve the user
+        $user=$repo_cnx->get_array('select use_id,use_login from ac_users 
where use_login=$1',
+                array($p_login));
+        if ( ! $user ) return false;
+        
+        // remove him from jnt_use_dos
+        $repo_cnx->exec_sql("delete from jnt_use_dos WHERE use_id=$1 and 
dos_id=$2",
+            array($user[0]['use_id'],$p_dossier));
+
+        // Remove user from user's dossier
+        $cn_dossier=new Database($p_dossier);
+        $cn_dossier->exec_sql("delete from profile_user where 
user_name=$1",array($p_login));
+        $cn_dossier->exec_sql("delete from user_sec_act where 
ua_login=$1",array($p_login));
+            
+    }
+    
+    /**
+     * Grant access to folder, grant administrator profile , all the ledgers 
and all the action
+     * 
+     */
+    static function grant_admin_access($p_login,$p_dossier) 
+    {
+         $repo_cnx=new Database();
+        $user=$repo_cnx->get_array("select use_id,use_login
+                                from ac_users
+                                where use_login=$1", array($p_login));
+
+        if ( ! $user ) return false;
+        $cn_dossier=new Database($p_dossier);
+        // if not access to DB
+        if ( 
+                $repo_cnx->get_value("select count(*) from jnt_use_dos where 
use_id=$1 and dos_id=$2",
+                        array($user[0]['use_id'],$p_dossier)) == 0
+                )
+        {
+            $repo_cnx->exec_sql("insert into jnt_use_dos(use_id,dos_id) values 
($1,$2)",
+                array($user[0]['use_id'], $p_dossier));
+        }
+        //------  Give him the admin menu
+        if ( $cn_dossier->get_value("select count(*) from profile_user where 
user_name=$1",
+                array($user[0]['use_login'])) == 0)
+        {
+            $cn_dossier->exec_sql('insert into profile_user(user_name,p_id) 
values($1,1)',
+                    array($user[0]['use_login']));
+        }
+        // Grant all action + ledger to him
+        $cn_dossier->exec_sql("delete from user_sec_act where 
ua_login=$1",array($p_login));
+
+        $cn_dossier->exec_sql("insert into user_sec_act (ua_login,ua_act_id)"
+                ." select $1 ,ac_id from action ",array($p_login));
+
+        $cn_dossier->exec_sql("delete from user_sec_jrn where 
uj_login=$1",array($p_login));
+        $cn_dossier->exec_sql("insert into 
user_sec_jrn(uj_login,uj_jrn_id,uj_priv)"
+                ." select $1,jrn_def_id,'W' from jrn_def",
+                        array($p_login));
+
+
+    }
 }
 
 ?>
diff --git a/unit-test/include/class/class_dossierTest.php 
b/unit-test/include/class/class_dossierTest.php
new file mode 100644
index 0000000..3b6bec8
--- /dev/null
+++ b/unit-test/include/class/class_dossierTest.php
@@ -0,0 +1,233 @@
+<?php
+
+/**
+ * Generated by PHPUnit_SkeletonGenerator on 2016-02-11 at 15:39:21.
+ */
+class DossierTest extends PHPUnit_Framework_TestCase
+{
+
+    /**
+     * @var Dossier
+     */
+    protected $object;
+
+    /**
+     * Sets up the fixture, for example, opens a network connection.
+     * This method is called before a test is executed.
+     */
+    protected function setUp()
+    {
+        $this->object=new Dossier(DOSSIER);
+    }
+
+    /**
+     * Tears down the fixture, for example, closes a network connection.
+     * This method is called after a test is executed.
+     */
+    protected function tearDown()
+    {
+        
+    }
+
+    /**
+     * @covers Dossier::id
+     * @todo   Implement testId().
+     */
+    public function testId()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::show_dossier
+     * @todo   Implement testShow_dossier().
+     */
+    public function testShow_dossier()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::count
+     * @todo   Implement testCount().
+     */
+    public function testCount()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::get_user_folder
+     * @todo   Implement testGet_user_folder().
+     */
+    public function testGet_user_folder()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::check
+     * @todo   Implement testCheck().
+     */
+    public function testCheck()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::get
+     * @todo   Implement testGet().
+     */
+    public function testGet()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::hidden
+     * @todo   Implement testHidden().
+     */
+    public function testHidden()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::name
+     * @todo   Implement testName().
+     */
+    public function testName()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::get_parameter
+     * @todo   Implement testGet_parameter().
+     */
+    public function testGet_parameter()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::set_parameter
+     * @todo   Implement testSet_parameter().
+     */
+    public function testSet_parameter()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::get_info
+     * @todo   Implement testGet_info().
+     */
+    public function testGet_info()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::save
+     * @todo   Implement testSave().
+     */
+    public function testSave()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::update
+     * @todo   Implement testUpdate().
+     */
+    public function testUpdate()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::load
+     * @todo   Implement testLoad().
+     */
+    public function testLoad()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::get_version
+     * @todo   Implement testGet_version().
+     */
+    public function testGet_version()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::connect
+     * @todo   Implement testConnect().
+     */
+    public function testConnect()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers Dossier::synchro_admin
+     * @todo   Implement testSynchro_admin().
+     */
+    public function testSynchro_admin()
+    {
+       Dossier::synchro_admin(DOSSIER);
+    }
+
+}
diff --git a/unit-test/include/class/class_userTest.php 
b/unit-test/include/class/class_userTest.php
new file mode 100644
index 0000000..df95410
--- /dev/null
+++ b/unit-test/include/class/class_userTest.php
@@ -0,0 +1,620 @@
+<?php
+define ('USE_ID',999999);
+define ('USE_FIRST_NAME','Unit test');
+define ('USE_NAME','UNIT');
+define ('USE_LOGIN','unit-test');
+define ('USE_ACTIVE',1);
+define ('USE_PASS','passord');
+define ('USE_ADMIN',0);
+define ('USE_EMAIL','address@hidden');
+/**
+ * Generated by PHPUnit_SkeletonGenerator on 2016-02-10 at 22:48:23.
+ */
+class UserTest extends PHPUnit_Framework_TestCase
+{
+
+    /**
+     * @var User
+     */
+    protected $object;
+
+    /**
+     * Sets up the fixture, for example, opens a network connection.
+     * This method is called before a test is executed.
+     */
+    protected function setUp()
+    {
+        // create database connx : 
+        $this->cn=new Database();
+        // create a user 
+        $this->cn->exec_sql('delete from jnt_use_dos where 
use_id=$1',array(USE_ID));
+        $this->cn->exec_sql('delete from ac_users where 
use_id=$1',array(USE_ID));
+        $this->cn->exec_sql('insert into ac_users 
(use_id,use_first_name,use_name,use_login,use_active,use_pass,use_admin,use_email)
 values ($1,$2,$3,$4,$5,$6,$7,$8)',
+                
array(USE_ID,USE_FIRST_NAME,USE_NAME,USE_LOGIN,USE_ACTIVE,USE_PASS,USE_ADMIN,USE_EMAIL));
+        
+        $this->object=new User($cn,USE_ID);
+    }
+
+    /**
+     * Tears down the fixture, for example, closes a network connection.
+     * This method is called after a test is executed.
+     */
+    protected function tearDown()
+    {
+        //drop user
+        $this->cn->exec_sql('delete from jnt_use_dos where 
use_id=$1',array(USE_ID));
+        $this->cn->exec_sql('delete from ac_users where use_id = 
$1',array(USE_ID));
+    }
+
+    /**
+     * @covers User::load
+     * @todo   Implement testLoad().
+     */
+    public function testLoad()
+    {
+        
+        $this->object->load();
+        $this->assertEquals($this->object->id , USE_ID) ;
+        $this->assertEquals($this->object->name , USE_NAME) ;
+        $this->assertEquals($this->object->first_name , USE_FIRST_NAME );
+        $this->assertEquals($this->object->login , USE_LOGIN) ;
+        $this->assertEquals($this->object->active , USE_ACTIVE) ;
+        $this->assertEquals($this->object->password, USE_PASS) ;
+        $this->assertEquals($this->object->admin , USE_ADMIN) ;
+        $this->assertEquals($this->object->email , USE_EMAIL) ;
+        
+        
+    }
+
+    /**
+     * @covers User::save
+     * @todo   Implement testSave().
+     */
+    public function testSave()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::insert
+     * @todo   Implement testInsert().
+     */
+    public function testInsert()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::Check
+     * @todo   Implement testCheck().
+     */
+    public function testCheck()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_folder_access
+     * @todo   Implement testGet_folder_access().
+     */
+    public function testGet_folder_access()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::set_folder_access
+     * @todo   Implement testSet_folder_access().
+     */
+    public function testSet_folder_access()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_ledger_access
+     * @todo   Implement testGet_ledger_access().
+     */
+    public function testGet_ledger_access()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_ledger
+     * @todo   Implement testGet_ledger().
+     */
+    public function testGet_ledger()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_ledger_sql
+     * @todo   Implement testGet_ledger_sql().
+     */
+    public function testGet_ledger_sql()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::Admin
+     * @todo   Implement testAdmin().
+     */
+    public function testAdmin()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::set_periode
+     * @todo   Implement testSet_periode().
+     */
+    public function testSet_periode()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_periode
+     * @todo   Implement testGet_periode().
+     */
+    public function testGet_periode()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_mini_report
+     * @todo   Implement testGet_mini_report().
+     */
+    public function testGet_mini_report()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::set_mini_report
+     * @todo   Implement testSet_mini_report().
+     */
+    public function testSet_mini_report()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::save_global_preference
+     * @todo   Implement testSave_global_preference().
+     */
+    public function testSave_global_preference()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_preference
+     * @todo   Implement testGet_preference().
+     */
+    public function testGet_preference()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::check_module
+     * @todo   Implement testCheck_module().
+     */
+    public function testCheck_module()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::check_action
+     * @todo   Implement testCheck_action().
+     */
+    public function testCheck_action()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::load_global_pref
+     * @todo   Implement testLoad_global_pref().
+     */
+    public function testLoad_global_pref()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::insert_default_global_pref
+     * @todo   Implement testInsert_default_global_pref().
+     */
+    public function testInsert_default_global_pref()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::update_global_pref
+     * @todo   Implement testUpdate_global_pref().
+     */
+    public function testUpdate_global_pref()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_exercice
+     * @todo   Implement testGet_exercice().
+     */
+    public function testGet_exercice()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::can_request
+     * @todo   Implement testCan_request().
+     */
+    public function testCan_request()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::check_print
+     * @todo   Implement testCheck_print().
+     */
+    public function testCheck_print()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::can_print
+     * @todo   Implement testCan_print().
+     */
+    public function testCan_print()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::is_local_admin
+     * @todo   Implement testIs_local_admin().
+     */
+    public function testIs_local_admin()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_available_repository
+     * @todo   Implement testGet_available_repository().
+     */
+    public function testGet_available_repository()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_list
+     * @todo   Implement testGet_list().
+     */
+    public function testGet_list()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::check_jrn
+     * @todo   Implement testCheck_jrn().
+     */
+    public function testCheck_jrn()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::check_dossier
+     * @todo   Implement testCheck_dossier().
+     */
+    public function testCheck_dossier()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_limit_current_exercice
+     * @todo   Implement testGet_limit_current_exercice().
+     */
+    public function testGet_limit_current_exercice()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::show_dossier
+     * @todo   Implement testShow_dossier().
+     */
+    public function testShow_dossier()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_available_folder
+     * @todo   Implement testGet_available_folder().
+     */
+    public function testGet_available_folder()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::audit
+     * @todo   Implement testAudit().
+     */
+    public function testAudit()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::save_profile
+     * @todo   Implement testSave_profile().
+     */
+    public function testSave_profile()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_profile
+     * @todo   Implement testGet_profile().
+     */
+    public function testGet_profile()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_writable_profile
+     * @todo   Implement testGet_writable_profile().
+     */
+    public function testGet_writable_profile()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::get_readable_profile
+     * @todo   Implement testGet_readable_profile().
+     */
+    public function testGet_readable_profile()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::can_add_action
+     * @todo   Implement testCan_add_action().
+     */
+    public function testCan_add_action()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::can_write_action
+     * @todo   Implement testCan_write_action().
+     */
+    public function testCan_write_action()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::can_read_action
+     * @todo   Implement testCan_read_action().
+     */
+    public function testCan_read_action()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::can_write_repo
+     * @todo   Implement testCan_write_repo().
+     */
+    public function testCan_write_repo()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::can_read_repo
+     * @todo   Implement testCan_read_repo().
+     */
+    public function testCan_read_repo()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::save_password
+     * @todo   Implement testSave_password().
+     */
+    public function testSave_password()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::save_email
+     * @todo   Implement testSave_email().
+     */
+    public function testSave_email()
+    {
+        // Remove the following lines when you implement this test.
+        $this->markTestIncomplete(
+                'This test has not been implemented yet.'
+        );
+    }
+
+    /**
+     * @covers User::revoke_access
+     * @todo   Implement testRevoke_access().
+     */
+    public function testRevoke_access()
+    {
+        $cn_dossier=new Database(DOSSIER);
+       User::revoke_access(USE_LOGIN, DOSSIER);
+       $this->assertEquals($cn_dossier->get_value('select count(*) from 
profile_user where user_name =$1 ',array(USE_LOGIN)),0);
+    }
+
+    /**
+     * @covers User::grant_admin_access
+     * @todo   Implement testGrant_admin_access()
+     */
+    public function testGrant_admin_access()
+    {
+       $cn_dossier=new Database(TARGET);
+       User::grant_admin_access(USE_LOGIN, DOSSIER);
+       
+       $this->assertEquals($cn_dossier->get_value('select count(*) from 
profile_user where user_name =$1 ',array(USE_LOGIN)),1);
+    }
+
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]