| @@ 1073-1091 (lines=19) @@ | ||
| 1070 | * @param Member $member |
|
| 1071 | * @return bool |
|
| 1072 | */ |
|
| 1073 | public function canPublish($member = null) |
|
| 1074 | { |
|
| 1075 | if (!$member) { |
|
| 1076 | $member = Security::getCurrentUser(); |
|
| 1077 | } |
|
| 1078 | ||
| 1079 | // Check extension |
|
| 1080 | $extended = $this->extendedCan('canPublish', $member); |
|
| 1081 | if ($extended !== null) { |
|
| 1082 | return $extended; |
|
| 1083 | } |
|
| 1084 | ||
| 1085 | if (Permission::checkMember($member, "ADMIN")) { |
|
| 1086 | return true; |
|
| 1087 | } |
|
| 1088 | ||
| 1089 | // Default to relying on edit permission |
|
| 1090 | return $this->canEdit($member); |
|
| 1091 | } |
|
| 1092 | ||
| 1093 | /** |
|
| 1094 | * This function should return true if the current user can delete this page. It can be overloaded to customise the |
|
| @@ 1208-1228 (lines=21) @@ | ||
| 1205 | * unit tests) |
|
| 1206 | * @return bool True if the current user can edit this page |
|
| 1207 | */ |
|
| 1208 | public function canEdit($member = null) |
|
| 1209 | { |
|
| 1210 | if (!$member) { |
|
| 1211 | $member = Security::getCurrentUser(); |
|
| 1212 | } |
|
| 1213 | ||
| 1214 | // Standard mechanism for accepting permission changes from extensions |
|
| 1215 | $extended = $this->extendedCan('canEdit', $member); |
|
| 1216 | if ($extended !== null) { |
|
| 1217 | return $extended; |
|
| 1218 | } |
|
| 1219 | ||
| 1220 | // Default permissions |
|
| 1221 | if (Permission::checkMember($member, "SITETREE_EDIT_ALL")) { |
|
| 1222 | return true; |
|
| 1223 | } |
|
| 1224 | ||
| 1225 | // Check inherited permissions |
|
| 1226 | return static::getPermissionChecker() |
|
| 1227 | ->canEdit($this->ID, $member); |
|
| 1228 | } |
|
| 1229 | ||
| 1230 | /** |
|
| 1231 | * Stub method to get the site config, unless the current class can provide an alternate. |
|