Dependency Graph

Dependency Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

IDProjectCategoryView StatusLast Update
16801Development Otherpublic2021-01-12 13:46
ReporterDenisChenu Assigned Toollehar  
PrioritynoneSeverityminor 
Status testingResolutionopen 
Product Version3.x 
Summary16801: Permission function by model review
DescriptionCurrent function can/must be static.There are permission function that clearly don't need model i think they must eb moved to static function keep the dynamic one as deprecated since it can be used by Plugins.

Steps To ReproduceAlternate solution :

LSActiveRecord->model()->findByPk()->hasPermission()

````
function hasPermission($objectId, $permission, $crud, $userId) {
    return Permission::hasPermission(0, 'global', get_class($this), $crud , $userId)
        || Permission::hasPermission($objectId, get_class($this), $permission, $crud , $userId);
}
````

Extend in Survey, SurveysGroups, SurveysInGroup (currently)

Set @deprecated for hasSurveyPermission
remove hasSurveysGroupsPermission and hasSurveysInGroupPermission
Check for hasRolePermission, hasTemplatePermission and hasGlobalPermission
Additional InformationFunction :
- [hasPermission](https://github.com/LimeSurvey/LimeSurvey/blob/76c3ea9521b1adb0dc47b7c0b5fb0dce929ef6a3/application/models/Permission.php#L418)
- [hasGlobalPermission](https://github.com/LimeSurvey/LimeSurvey/blob/76c3ea9521b1adb0dc47b7c0b5fb0dce929ef6a3/application/models/Permission.php#L542)
- [hasSurveyPermission](https://github.com/LimeSurvey/LimeSurvey/blob/76c3ea9521b1adb0dc47b7c0b5fb0dce929ef6a3/application/models/Permission.php#L556)
- [hasRolePermission](https://github.com/LimeSurvey/LimeSurvey/blob/76c3ea9521b1adb0dc47b7c0b5fb0dce929ef6a3/application/models/Permission.php#L580)
- [hasTemplatePermission](https://github.com/LimeSurvey/LimeSurvey/blob/76c3ea9521b1adb0dc47b7c0b5fb0dce929ef6a3/application/models/Permission.php#L592)

About all hasEntityPermission : did we create new one or use a global one for future ?
TagsNo tags attached.

Relationships

parent of 16440 testingcdorin Feature requests Survey group Permission : minimal system 
Not all the children of this issue are yet resolved or closed.

Activities

DenisChenu

DenisChenu

2021-01-12 13:45

developer   ~61493

https://github.com/LimeSurvey/LimeSurvey/pull/1709
DenisChenu

DenisChenu

2021-01-12 13:46

developer   ~61494

Template and Role don't use `Permission::setPermission` and other function :)

Issue History

Date Modified Username Field Change
2020-10-31 11:40 DenisChenu New Issue
2020-10-31 11:41 DenisChenu Relationship added parent of 16440
2021-01-06 11:13 DenisChenu Summary Some Permission function can/must be static => Permission function by model review
2021-01-06 11:13 DenisChenu Description Updated View Revisions
2021-01-06 11:13 DenisChenu Steps to Reproduce Updated View Revisions
2021-01-06 11:16 ollehar Issue Monitored: ollehar
2021-01-12 13:45 DenisChenu Assigned To => ollehar
2021-01-12 13:45 DenisChenu Status new => testing
2021-01-12 13:45 DenisChenu Note Added: 61493
2021-01-12 13:46 DenisChenu Note Added: 61494