Open Journal Systems  3.3.0
UserGroupDAO Class Reference
Inheritance diagram for UserGroupDAO:
DAO

Public Member Functions

 __construct ()
 
 _getSearchSql ($searchType, $search, $searchMatch, &$params)
 
 _returnFromRow ($row)
 
 assignGroupToStage ($contextId, $userGroupId, $stageId)
 
 assignUserToGroup ($userId, $groupId)
 
 contextHasGroup ($contextId, $userGroupId)
 
 deleteAssignmentsByContextId ($contextId, $userId=null)
 
 deleteAssignmentsByUserGroupId ($userGroupId)
 
 deleteAssignmentsByUserId ($userId, $userGroupId=null)
 
 deleteByContextId ($contextId)
 
 deleteById ($contextId, $userGroupId)
 
 deleteObject ($userGroup)
 
 deleteSettingsByLocale ($locale)
 
 getAdditionalFieldNames ()
 
 getAssignedStagesByUserGroupId ($contextId, $userGroupId)
 
 getByContextId ($contextId=null, $dbResultRange=null)
 
 getById ($userGroupId, $contextId=null)
 
 getByRoleId ($contextId, $roleId, $default=false, $dbResultRange=null)
 
 getByUserId ($userId, $contextId=null)
 
 getContextUsersCount ($contextId, $userGroupId=null, $roleId=null)
 
 getDefaultByRoleId ($contextId, $roleId)
 
 getInsertId ()
 
 getLocaleFieldNames ()
 
 getPermitMetadataEditGroupIds ($contextId, $roleId=null)
 
 getRecommendOnlyGroupIds ($contextId, $roleId=null)
 
 getSetting ($userGroupId, $name, $locale=null)
 
 getUserGroupIdsByRoleId ($roleId, $contextId=null)
 
 getUserGroupsByStage ($contextId, $stageId, $roleId=null, $dbResultRange=null)
 
 getUsersByContextId ($contextId, $searchType=null, $search=null, $searchMatch=null, $dbResultRange=null)
 
 getUsersById ($userGroupId=null, $contextId=null, $searchType=null, $search=null, $searchMatch=null, $dbResultRange=null)
 
 getUsersNotInRole ($roleId, $contextId=null, $search=null, $rangeInfo=null)
 
 insertObject ($userGroup)
 
 installLocale ($locale, $contextId=null)
 
 installSettings ($contextId, $filename)
 
 isDefault ($userGroupId)
 
 newDataObject ()
 
 removeAllStagesFromGroup ($contextId, $userGroupId)
 
 removeGroupFromStage ($contextId, $userGroupId, $stageId)
 
 removeUserFromGroup ($userId, $groupId, $contextId)
 
 updateLocaleFields ($userGroup)
 
 updateObject ($userGroup)
 
 updateSetting ($userGroupId, $name, $value, $type=null, $isLocalized=false)
 
 userAssignmentExists ($contextId, $userId, $stageId)
 
 userGroupAssignedToStage ($userGroupId, $stageId)
 
 userInAnyGroup ($userId, $contextId=null)
 
 userInGroup ($userId, $userGroupId)
 
- Public Member Functions inherited from DAO
 __construct ($dataSource=null, $callHooks=true)
 
 concat ()
 
 convertFromDB ($value, $type)
 
 convertToDB ($value, &$type)
 
 dateFromDB ($d)
 
 datetimeFromDB ($dt)
 
 datetimeToDB ($dt)
 
 dateToDB ($d)
 
 flushCache ()
 
 formatDateToDB ($date, $defaultNumWeeks=null, $acceptPastDate=true)
 
 getAffectedRows ()
 
 getDataObjectSettings ($tableName, $idFieldName, $idFieldValue, $dataObject)
 
 getDataSource ()
 
 getDirectionMapping ($direction)
 
 getDriver ()
 
 getType ($value)
 
 handleError ($dataSource, $sql)
 
 nullOrInt ($value)
 
 replace ($table, $arrFields, $keyCols)
 
retrieve ($sql, $params=false, $callHooks=true)
 
retrieveCached ($sql, $params=false, $secsToCache=3600, $callHooks=true)
 
retrieveLimit ($sql, $params=false, $numRows=false, $offset=false, $callHooks=true)
 
retrieveRange ($sql, $params=false, $dbResultRange=null, $callHooks=true)
 
 setCacheDir ()
 
 setDataSource ($dataSource)
 
 update ($sql, $params=false, $callHooks=true, $dieOnError=true)
 
 updateDataObjectSettings ($tableName, $dataObject, $idArray)
 

Static Public Member Functions

static getNotChangeMetadataEditPermissionRoles ()
 
- Static Public Member Functions inherited from DAO
static getDataChangedEvent ($elementId=null, $parentElementId=null, $content='')
 

Data Fields

 $userDao
 
 $userGroupAssignmentDao
 
- Data Fields inherited from DAO
 $_dataSource
 

Additional Inherited Members

- Protected Member Functions inherited from DAO
 _getInsertId ($table='', $id='')
 

Detailed Description

Operations for retrieving and modifying User Groups and user group assignments.

See also
UserGroup

Definition at line 21 of file UserGroupDAO.inc.php.

Constructor & Destructor Documentation

◆ __construct()

UserGroupDAO::__construct ( )

Constructor.

Definition at line 37 of file UserGroupDAO.inc.php.

References DAORegistry\getDAO().

Member Function Documentation

◆ _getSearchSql()

UserGroupDAO::_getSearchSql (   $searchType,
  $search,
  $searchMatch,
$params 
)

private function to assemble the SQL for searching users.

Parameters
string$searchTypethe field to search on.
string$searchthe keywords to search for.
string$searchMatchwhere to match (is, contains, startsWith).
array$paramsSQL parameter array reference
Returns
string SQL search snippet

Definition at line 822 of file UserGroupDAO.inc.php.

References DAO\concat().

Referenced by getUsersById().

◆ _returnFromRow()

UserGroupDAO::_returnFromRow (   $row)

Internal function to return a UserGroup object from a row.

Parameters
$rowarray
Returns
UserGroup

Definition at line 56 of file UserGroupDAO.inc.php.

References HookRegistry\call(), DAO\getDataObjectSettings(), and newDataObject().

Referenced by getById().

◆ assignGroupToStage()

UserGroupDAO::assignGroupToStage (   $contextId,
  $userGroupId,
  $stageId 
)

Assign a user group to a stage

Parameters
$contextIdint
$userGroupIdint
$stageIdint

Definition at line 612 of file UserGroupDAO.inc.php.

References DAO\update().

Referenced by installSettings().

◆ assignUserToGroup()

UserGroupDAO::assignUserToGroup (   $userId,
  $groupId 
)

Assign a given user to a given user group

Parameters
int$userId
int$groupId

Definition at line 572 of file UserGroupDAO.inc.php.

◆ contextHasGroup()

UserGroupDAO::contextHasGroup (   $contextId,
  $userGroupId 
)

Validation check to see if user group exists for a given context

Parameters
$contextId
$userGroupId
Returns
bool

Definition at line 383 of file UserGroupDAO.inc.php.

References DAO\retrieve().

◆ deleteAssignmentsByContextId()

UserGroupDAO::deleteAssignmentsByContextId (   $contextId,
  $userId = null 
)

Remove all user group assignments for a given user in a context

Parameters
int$contextId
int$userId

Definition at line 563 of file UserGroupDAO.inc.php.

◆ deleteAssignmentsByUserGroupId()

UserGroupDAO::deleteAssignmentsByUserGroupId (   $userGroupId)

Delete all assignments to a given user group

Parameters
unknown_type$userGroupId

Definition at line 554 of file UserGroupDAO.inc.php.

◆ deleteAssignmentsByUserId()

UserGroupDAO::deleteAssignmentsByUserId (   $userId,
  $userGroupId = null 
)

Delete all user group assignments for a given userId

Parameters
int$userId

Definition at line 546 of file UserGroupDAO.inc.php.

◆ deleteByContextId()

UserGroupDAO::deleteByContextId (   $contextId)

Delete a user group by its context id

Parameters
$contextIdint

Definition at line 154 of file UserGroupDAO.inc.php.

References DAO\retrieve(), and DAO\update().

◆ deleteById()

UserGroupDAO::deleteById (   $contextId,
  $userGroupId 
)

Delete a user group by its id will also delete related settings and all the assignments to this group

Parameters
$contextIdint
$userGroupIdint

Definition at line 133 of file UserGroupDAO.inc.php.

References removeAllStagesFromGroup(), and DAO\update().

Referenced by deleteObject().

◆ deleteObject()

UserGroupDAO::deleteObject (   $userGroup)

Delete a user group. will also delete related settings and all the assignments to this group

Parameters
$userGroupUserGroup

Definition at line 145 of file UserGroupDAO.inc.php.

References deleteById().

◆ deleteSettingsByLocale()

UserGroupDAO::deleteSettingsByLocale (   $locale)

Remove all settings associated with a locale

Parameters
$locale

Definition at line 810 of file UserGroupDAO.inc.php.

References DAO\update().

◆ getAdditionalFieldNames()

UserGroupDAO::getAdditionalFieldNames ( )

Get a list of additional field names to store in this DAO. This can be used to extend the table with virtual "columns", typically using the ..._settings table.

Returns
array List of strings representing field names.

Reimplemented from DAO.

Definition at line 187 of file UserGroupDAO.inc.php.

◆ getAssignedStagesByUserGroupId()

UserGroupDAO::getAssignedStagesByUserGroupId (   $contextId,
  $userGroupId 
)

Get all stages assigned to one user group in one context.

Parameters
$contextIdint The context ID.
$userGroupIdint The user group ID
Returns
array

Definition at line 919 of file UserGroupDAO.inc.php.

References WorkflowStageDAO\getTranslationKeyFromId(), and DAO\retrieve().

Referenced by removeAllStagesFromGroup().

◆ getByContextId()

UserGroupDAO::getByContextId (   $contextId = null,
  $dbResultRange = null 
)

Retrieve user groups for a given context (all contexts if null)

Parameters
Integer$contextId(optional)
DBResultRange$dbResultRange(optional)
Returns
DAOResultFactory

Definition at line 407 of file UserGroupDAO.inc.php.

References DAO\retrieveRange().

Referenced by installLocale().

◆ getById()

UserGroupDAO::getById (   $userGroupId,
  $contextId = null 
)

Get an individual user group

Parameters
$userGroupIdint User group ID
$contextIdint Optional context ID to use for validation

Definition at line 209 of file UserGroupDAO.inc.php.

References _returnFromRow(), and DAO\retrieve().

◆ getByRoleId()

UserGroupDAO::getByRoleId (   $contextId,
  $roleId,
  $default = false,
  $dbResultRange = null 
)

Get all user groups belonging to a role

Parameters
Integer$contextId
Integer$roleId
boolean$default(optional)
DBResultRange$dbResultRange(optional)
Returns
DAOResultFactory

Definition at line 261 of file UserGroupDAO.inc.php.

References DAO\retrieveRange().

Referenced by getDefaultByRoleId().

◆ getByUserId()

UserGroupDAO::getByUserId (   $userId,
  $contextId = null 
)

Retrieve user groups to which a user is assigned.

Parameters
$userIdint
$contextIdint
Returns
DAOResultFactory

Definition at line 361 of file UserGroupDAO.inc.php.

References DAO\retrieve().

◆ getContextUsersCount()

UserGroupDAO::getContextUsersCount (   $contextId,
  $userGroupId = null,
  $roleId = null 
)

Retrieve the number of users associated with the specified context.

Parameters
$contextIdint
Returns
int

Definition at line 427 of file UserGroupDAO.inc.php.

References DAO\retrieve().

◆ getDefaultByRoleId()

UserGroupDAO::getDefaultByRoleId (   $contextId,
  $roleId 
)

Get a single default user group with a particular roleId

Parameters
$contextIdint Context ID
$roleIdint ROLE_ID_...

Definition at line 227 of file UserGroupDAO.inc.php.

References getByRoleId().

◆ getInsertId()

UserGroupDAO::getInsertId ( )

Get the ID of the last inserted user group.

Returns
int

Definition at line 172 of file UserGroupDAO.inc.php.

References DAO\_getInsertId().

Referenced by insertObject().

◆ getLocaleFieldNames()

UserGroupDAO::getLocaleFieldNames ( )

Get field names for which data is localized.

Returns
array

Reimplemented from DAO.

Definition at line 180 of file UserGroupDAO.inc.php.

◆ getNotChangeMetadataEditPermissionRoles()

static UserGroupDAO::getNotChangeMetadataEditPermissionRoles ( )
static

Get a list of roles not able to change submissionMetadataEdit permission option.

Returns
array

Definition at line 1046 of file UserGroupDAO.inc.php.

Referenced by UserGroupForm\execute(), and UserGroupForm\fetch().

◆ getPermitMetadataEditGroupIds()

UserGroupDAO::getPermitMetadataEditGroupIds (   $contextId,
  $roleId = null 
)

Get all user group IDs with permit_metadata_edit option enabled.

Parameters
$contextIdinteger
$roleIdinteger (optional)
Returns
array

Definition at line 1019 of file UserGroupDAO.inc.php.

References DAO\retrieve().

◆ getRecommendOnlyGroupIds()

UserGroupDAO::getRecommendOnlyGroupIds (   $contextId,
  $roleId = null 
)

Get all user group IDs with recommendOnly option enabled.

Parameters
$contextIdinteger
$roleIdinteger (optional)
Returns
array

Definition at line 990 of file UserGroupDAO.inc.php.

References DAO\retrieve().

◆ getSetting()

UserGroupDAO::getSetting (   $userGroupId,
  $name,
  $locale = null 
)

Retrieve a context setting value.

Parameters
$userGroupIdint
$namestring
$localestring optional
Returns
mixed

Definition at line 682 of file UserGroupDAO.inc.php.

References DAO\convertFromDB(), and DAO\retrieve().

Referenced by installLocale().

◆ getUserGroupIdsByRoleId()

UserGroupDAO::getUserGroupIdsByRoleId (   $roleId,
  $contextId = null 
)

Get an array of user group ids belonging to a given role

Parameters
$roleIdint ROLE_ID_...
$contextIdint Context ID

Definition at line 283 of file UserGroupDAO.inc.php.

References DAO\retrieve().

◆ getUserGroupsByStage()

UserGroupDAO::getUserGroupsByStage (   $contextId,
  $stageId,
  $roleId = null,
  $dbResultRange = null 
)

Get the user groups assigned to each stage.

Parameters
int$contextIdContext ID
int$stageIdWORKFLOW_STAGE_ID_...
int$roleIdOptional ROLE_ID_... to filter results by
DBResultRange(optional) $dbResultRange
Returns
DAOResultFactory

Definition at line 893 of file UserGroupDAO.inc.php.

References DAO\retrieveRange().

◆ getUsersByContextId()

UserGroupDAO::getUsersByContextId (   $contextId,
  $searchType = null,
  $search = null,
  $searchMatch = null,
  $dbResultRange = null 
)

return an Iterator of User objects given the search parameters

Parameters
int$contextId
string$searchType
string$search
string$searchMatch
DBResultRange$dbResultRange
Returns
DAOResultFactory

Definition at line 456 of file UserGroupDAO.inc.php.

References getUsersById().

◆ getUsersById()

UserGroupDAO::getUsersById (   $userGroupId = null,
  $contextId = null,
  $searchType = null,
  $search = null,
  $searchMatch = null,
  $dbResultRange = null 
)

return an Iterator of User objects given the search parameters

Parameters
int$userGroupIdoptional
int$contextIdoptional
string$searchType
string$search
string$searchMatch
DBResultRange$dbResultRange
Returns
DAOResultFactory

Definition at line 506 of file UserGroupDAO.inc.php.

References _getSearchSql(), and DAO\retrieveRange().

Referenced by getUsersByContextId().

◆ getUsersNotInRole()

UserGroupDAO::getUsersNotInRole (   $roleId,
  $contextId = null,
  $search = null,
  $rangeInfo = null 
)

Find users that don't have a given role

Parameters
$roleIdROLE_ID_... int (const)
$contextIdint Optional context ID
$searchstring Optional search string
$rangeInfoRangeInfo Optional range info
Returns
DAOResultFactory

Definition at line 468 of file UserGroupDAO.inc.php.

References DAO\retrieveRange().

◆ insertObject()

UserGroupDAO::insertObject (   $userGroup)

Insert a user group.

Parameters
$userGroupUserGroup
Returns
int Inserted user group ID

Definition at line 78 of file UserGroupDAO.inc.php.

References getInsertId(), DAO\update(), and updateLocaleFields().

Referenced by installSettings().

◆ installLocale()

UserGroupDAO::installLocale (   $locale,
  $contextId = null 
)

use the locale keys stored in the settings table to install the locale settings

Parameters
$locale
$contextId

Definition at line 783 of file UserGroupDAO.inc.php.

References getByContextId(), getSetting(), and updateSetting().

Referenced by installSettings().

◆ installSettings()

UserGroupDAO::installSettings (   $contextId,
  $filename 
)

Load the XML file and move the settings to the DB

Parameters
$contextId
$filename
Returns
boolean true === success

Definition at line 720 of file UserGroupDAO.inc.php.

References assignGroupToStage(), DAORegistry\getDAO(), insertObject(), installLocale(), newDataObject(), and updateSetting().

◆ isDefault()

UserGroupDAO::isDefault (   $userGroupId)

Check whether the passed user group id is default or not.

Parameters
$userGroupIdInteger
Returns
boolean

Definition at line 238 of file UserGroupDAO.inc.php.

References DAO\retrieve().

◆ newDataObject()

UserGroupDAO::newDataObject ( )

create new data object (allows DAO to be subclassed)

Definition at line 47 of file UserGroupDAO.inc.php.

Referenced by _returnFromRow(), and installSettings().

◆ removeAllStagesFromGroup()

UserGroupDAO::removeAllStagesFromGroup (   $contextId,
  $userGroupId 
)

Delete all stage assignments in a user group.

Parameters
$contextIdint
$userGroupIdint

Definition at line 599 of file UserGroupDAO.inc.php.

References getAssignedStagesByUserGroupId(), and removeGroupFromStage().

Referenced by deleteById().

◆ removeGroupFromStage()

UserGroupDAO::removeGroupFromStage (   $contextId,
  $userGroupId,
  $stageId 
)

Remove a user group from a stage

Parameters
$contextIdint
$userGroupIdint
$stageIdint

Definition at line 625 of file UserGroupDAO.inc.php.

References DAO\update().

Referenced by removeAllStagesFromGroup().

◆ removeUserFromGroup()

UserGroupDAO::removeUserFromGroup (   $userId,
  $groupId,
  $contextId 
)

remove a given user from a given user group

Parameters
$userIdint
$groupIdint
$contextIdint

Definition at line 585 of file UserGroupDAO.inc.php.

◆ updateLocaleFields()

UserGroupDAO::updateLocaleFields (   $userGroup)

Update the localized data for this object

Parameters
$authorobject

Definition at line 198 of file UserGroupDAO.inc.php.

References DAO\updateDataObjectSettings().

Referenced by insertObject(), and updateObject().

◆ updateObject()

UserGroupDAO::updateObject (   $userGroup)

Update a user group.

Parameters
$userGroupUserGroup

Definition at line 103 of file UserGroupDAO.inc.php.

References DAO\update(), and updateLocaleFields().

◆ updateSetting()

UserGroupDAO::updateSetting (   $userGroupId,
  $name,
  $value,
  $type = null,
  $isLocalized = false 
)

Method for updatea userGroup setting

Parameters
$userGroupIdint
$namestring
$valuemixed
$typestring data type of the setting. If omitted, type will be guessed
$isLocalizedboolean

Definition at line 643 of file UserGroupDAO.inc.php.

References DAO\convertToDB(), DAO\replace(), and DAO\update().

Referenced by installLocale(), and installSettings().

◆ userAssignmentExists()

UserGroupDAO::userAssignmentExists (   $contextId,
  $userId,
  $stageId 
)

Check to see whether a user is assigned to a stage ID via a user group.

Parameters
$contextIdint
$userIdint
$staeIdint
Returns
boolean

Definition at line 966 of file UserGroupDAO.inc.php.

References DAO\retrieve().

◆ userGroupAssignedToStage()

UserGroupDAO::userGroupAssignedToStage (   $userGroupId,
  $stageId 
)

Check if a user group is assigned to a stage

Parameters
int$userGroupId
int$stageId
Returns
bool

Definition at line 944 of file UserGroupDAO.inc.php.

References DAO\retrieve().

◆ userInAnyGroup()

UserGroupDAO::userInAnyGroup (   $userId,
  $contextId = null 
)

Check if a user is in any user group

Parameters
$userIdint
$contextIdint optional
Returns
boolean

Definition at line 336 of file UserGroupDAO.inc.php.

References DAO\retrieve().

◆ userInGroup()

UserGroupDAO::userInGroup (   $userId,
  $userGroupId 
)

Check if a user is in a particular user group

Parameters
$contextIdint
$userIdint
$userGroupIdint
Returns
boolean

Definition at line 312 of file UserGroupDAO.inc.php.

References DAO\retrieve().

Field Documentation

◆ $userDao

a UserGroupDAO::$userDao

shortcut to get the UserDAO *

Definition at line 26 of file UserGroupDAO.inc.php.

◆ $userGroupAssignmentDao

a UserGroupDAO::$userGroupAssignmentDao

shortcut to get the UserGroupAssignmentDAO *

Definition at line 32 of file UserGroupDAO.inc.php.


The documentation for this class was generated from the following file: