Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Apply lock value on group of users via role or group : map the ajxp.l…
Browse files Browse the repository at this point in the history
…ock to a role parameter.
  • Loading branch information
cdujeu committed Sep 10, 2014
1 parent daa7c64 commit b9e48f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 12 additions & 5 deletions core/src/plugins/core.conf/class.AbstractAjxpUser.php
Expand Up @@ -207,20 +207,27 @@ public function setProfile($profile)

public function setLock($lockAction)
{
$this->rights["ajxp.lock"] = $lockAction;
//$this->rights["ajxp.lock"] = $lockAction;
$this->personalRole->setParameterValue('core.conf', 'USER_LOCK_ACTION', $lockAction);
$this->recomputeMergedRole();
}

public function removeLock()
{
$this->rights["ajxp.lock"] = false;
if(isSet($this->rights['ajxp.lock'])){
$this->rights["ajxp.lock"] = false;
}
$this->personalRole->setParameterValue('core.conf', 'USER_LOCK_ACTION', AJXP_VALUE_CLEAR);
$this->recomputeMergedRole();
}

public function getLock()
{
if (!empty($this->rights["ajxp.lock"])) {
return $this->rights["ajxp.lock"];
}
return false;
return $this->mergedRole->filterParameterValue('core.conf', 'USER_LOCK_ACTION', AJXP_REPO_SCOPE_ALL, false);
//return false;
}

public function isAdmin()
Expand Down Expand Up @@ -250,13 +257,13 @@ public function getParent()

public function canRead($rootDirId)
{
if(!empty($this->rights["ajxp.lock"])) return false;
if($this->getLock() != false) return false;
return $this->mergedRole->canRead($rootDirId);
}

public function canWrite($rootDirId)
{
if(!empty($this->rights["ajxp.lock"])) return false;
if($this->getLock() != false) return false;
return $this->mergedRole->canWrite($rootDirId);
}

Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.conf/manifest.xml
Expand Up @@ -24,6 +24,7 @@
<param name="country" scope="role,user" description="CONF_MESSAGE[Country]" label="CONF_MESSAGE[Country]" type="select" choices="fr|France,uk|United Kingdom,de|Germany" expose="true" editable="true"/>
<param name="lang" scope="role,user" description="CONF_MESSAGE[User Language]" label="CONF_MESSAGE[Language]" type="select" choices="AJXP_AVAILABLE_LANGUAGES" expose="true" editable="true"/>
<param name="DEFAULT_START_REPOSITORY" scope="role,user,group" description="CONF_MESSAGE[Default start repository]" label="CONF_MESSAGE[Default repository]" type="select" default="ajxp_home" choices="AJXP_AVAILABLE_REPOSITORIES" expose="true" editable="true"/>
<param name="USER_LOCK_ACTION" scope="role,group" description="CONF_MESSAGE[If set, this action will be triggered automatically at users login. Can be logout (to lock out the users), pass_change (to force password change), or anything else]" label="CONF_MESSAGE[Users Lock Action]" type="string" default=""/>
<param name="USER_SHARED_USERS_LIMIT" scope="user" description="CONF_MESSAGE[Maximum number of shared users per user]" label="CONF_MESSAGE[Shared users limit]" type="integer" expose="false" editable="false"/>
<global_param name="DIBI_PRECONFIGURATION" group="CONF_MESSAGE[Core SQL Connexion]" type="group_switch:dibi_provider" label="CONF_MESSAGE[SQL Connexion]" description="CONF_MESSAGE[Simple SQL Connexion definition that can be used by other sql-based plugins]" mandatory="false"/>
<global_param name="SAVE_GUEST_PREFERENCES" group="CONF_MESSAGE[Preferences Saving]" type="boolean" label="CONF_MESSAGE[Remember guest preferences]" description="If the 'guest' user is enabled, remember her preferences accross sessions." mandatory="true" default="false"/>
Expand Down

0 comments on commit b9e48f2

Please sign in to comment.