Skip to content

Commit

Permalink
New feature: New authentication method management
Browse files Browse the repository at this point in the history
Dev: Updating DB: grant auth_db permission to every existing user
  • Loading branch information
Aestu committed Mar 26, 2015
1 parent 3f6898f commit 32377e2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -13,7 +13,7 @@
*/

$config['versionnumber'] = "2.06a1";
$config['dbversionnumber'] = 179;
$config['dbversionnumber'] = 180;
$config['buildnumber'] = '';
$config['updatable'] = true;

Expand Down
30 changes: 30 additions & 0 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -1266,7 +1266,37 @@ function db_upgrade_all($iOldDBVersion) {
alterColumn('{{participants}}', 'lastname', "string(150)", false);
$oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>179),"stg_name='DBVersion'");
}
if ($iOldDBVersion < 180)
{
$aUsers = User::model()->findAll();
$aPerm = array(
'entity_id' => 0,
'entity' => 'global',
'uid' => 0,
'permission' => 'auth_db',
'create_p' => 0,
'read_p' => 1,
'update_p' => 0,
'delete_p' => 0,
'import_p' => 0,
'export_p' => 0
);

foreach ($aUsers as $oUser)
{
if (!Permission::model()->hasGlobalPermission('auth_db','read',$oUser->uid))

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Mar 26, 2015

Collaborator

Test if is_null ? Then if it set but to 0 : adding it ?

This comment has been minimized.

Copy link
@Aestu

Aestu Mar 29, 2015

Author Collaborator

hasGlobalPermission calls hasPermission who deals with a possible null value.

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Mar 30, 2015

Collaborator

Yes , but if it's already set to 0, then you create a new one ? I'm not sure of the effect, and how it's managed.

Never mind, i think of someine using GIT version. No body must use git version except for testing ....

{
$oPermission = new Permission;
foreach ($aPerm as $k => $v)
{
$oPermission->$k = $v;
}
$oPermission->uid = $oUser->uid;
$oPermission->save();
}
}
$oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>180),"stg_name='DBVersion'");
}
$oTransaction->commit();
// Activate schema caching
$oDB->schemaCachingDuration=3600;
Expand Down
4 changes: 2 additions & 2 deletions application/libraries/PluginManager/PluginManager.php
Expand Up @@ -75,14 +75,14 @@ public function getInstalledPlugins()
public function isPluginActive($sPluginName)
{
$pluginModel = Plugin::model();
$record = $pluginModel->findByAttributes(array('name' => $sPluginName));
$record = $pluginModel->findByAttributes(array('name' => $sPluginName, 'active' => '1'));
if ($record == false)
{
return false;
}
else
{
return $record->active;
return true;
}
}

Expand Down

1 comment on commit 32377e2

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks \o/

Please sign in to comment.