File indexing completed on 2024-12-22 05:33:40
0001 <?php 0002 0003 /** 0004 * ocs-webserver 0005 * 0006 * Copyright 2016 by pling GmbH. 0007 * 0008 * This file is part of ocs-webserver. 0009 * 0010 * This program is free software: you can redistribute it and/or modify 0011 * it under the terms of the GNU Affero General Public License as 0012 * published by the Free Software Foundation, either version 3 of the 0013 * License, or (at your option) any later version. 0014 * 0015 * This program is distributed in the hope that it will be useful, 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 * GNU Affero General Public License for more details. 0019 * 0020 * You should have received a copy of the GNU Affero General Public License 0021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0022 **/ 0023 class Default_Plugin_AclRules extends Zend_Acl 0024 { 0025 const ROLENAME_GUEST = 'guest'; 0026 const ROLENAME_COOKIEUSER = 'cookieuser'; 0027 const ROLENAME_FEUSER = 'feuser'; 0028 const ROLENAME_MODERATOR = 'moderator'; 0029 const ROLENAME_STAFF = 'staff'; 0030 const ROLENAME_ADMIN = 'admin'; 0031 const ROLENAME_SYSUSER = 'sysuser'; 0032 0033 function __construct() 0034 { 0035 $this->addRole(new Zend_Acl_Role (self::ROLENAME_GUEST)); 0036 $this->addRole(new Zend_Acl_Role (self::ROLENAME_COOKIEUSER), self::ROLENAME_GUEST); 0037 $this->addRole(new Zend_Acl_Role (self::ROLENAME_FEUSER), self::ROLENAME_COOKIEUSER); 0038 $this->addRole(new Zend_Acl_Role (self::ROLENAME_MODERATOR), self::ROLENAME_FEUSER); 0039 $this->addRole(new Zend_Acl_Role (self::ROLENAME_STAFF), self::ROLENAME_FEUSER); 0040 $this->addRole(new Zend_Acl_Role (self::ROLENAME_ADMIN)); 0041 $this->addRole(new Zend_Acl_Role (self::ROLENAME_SYSUSER)); 0042 0043 $this->addResource(new Zend_Acl_Resource ('default_logout')); 0044 $this->addResource(new Zend_Acl_Resource ('default_oauth')); 0045 0046 $this->addResource(new Zend_Acl_Resource ('default_authorization')); 0047 $this->addResource(new Zend_Acl_Resource ('default_button')); 0048 $this->addResource(new Zend_Acl_Resource ('default_categories')); 0049 $this->addResource(new Zend_Acl_Resource ('default_community')); 0050 $this->addResource(new Zend_Acl_Resource ('default_content')); 0051 $this->addResource(new Zend_Acl_Resource ('default_discovery')); 0052 $this->addResource(new Zend_Acl_Resource ('default_donationlist')); 0053 $this->addResource(new Zend_Acl_Resource ('default_support')); 0054 $this->addResource(new Zend_Acl_Resource ('default_subscription')); 0055 $this->addResource(new Zend_Acl_Resource ('default_error')); 0056 $this->addResource(new Zend_Acl_Resource ('default_explore')); 0057 $this->addResource(new Zend_Acl_Resource ('default_gateway')); 0058 $this->addResource(new Zend_Acl_Resource ('default_hive')); 0059 $this->addResource(new Zend_Acl_Resource ('default_home')); 0060 $this->addResource(new Zend_Acl_Resource ('default_ocsv1')); // OCS API 0061 $this->addResource(new Zend_Acl_Resource ('default_embedv1')); // embed API 0062 $this->addResource(new Zend_Acl_Resource ('default_membersetting')); 0063 $this->addResource(new Zend_Acl_Resource ('default_json')); 0064 $this->addResource(new Zend_Acl_Resource ('default_productcategory')); 0065 $this->addResource(new Zend_Acl_Resource ('default_productcomment')); 0066 $this->addResource(new Zend_Acl_Resource ('default_product')); 0067 $this->addResource(new Zend_Acl_Resource ('default_report')); 0068 $this->addResource(new Zend_Acl_Resource ('default_rectification')); 0069 $this->addResource(new Zend_Acl_Resource ('default_rss')); 0070 $this->addResource(new Zend_Acl_Resource ('default_settings')); 0071 $this->addResource(new Zend_Acl_Resource ('default_supporterbox')); 0072 $this->addResource(new Zend_Acl_Resource ('default_plingbox')); 0073 $this->addResource(new Zend_Acl_Resource ('default_user')); 0074 $this->addResource(new Zend_Acl_Resource ('default_widget')); 0075 $this->addResource(new Zend_Acl_Resource ('default_file')); 0076 $this->addResource(new Zend_Acl_Resource ('default_plings')); 0077 $this->addResource(new Zend_Acl_Resource ('default_gitfaq')); 0078 $this->addResource(new Zend_Acl_Resource ('default_spam')); 0079 $this->addResource(new Zend_Acl_Resource ('default_moderation')); 0080 $this->addResource(new Zend_Acl_Resource ('default_duplicates')); 0081 $this->addResource(new Zend_Acl_Resource ('default_newproducts')); 0082 $this->addResource(new Zend_Acl_Resource ('default_misuse')); 0083 $this->addResource(new Zend_Acl_Resource ('default_credits')); 0084 $this->addResource(new Zend_Acl_Resource ('default_ads')); 0085 $this->addResource(new Zend_Acl_Resource ('default_dl')); 0086 $this->addResource(new Zend_Acl_Resource ('default_password')); 0087 $this->addResource(new Zend_Acl_Resource ('default_verify')); 0088 $this->addResource(new Zend_Acl_Resource ('default_login')); 0089 $this->addResource(new Zend_Acl_Resource ('default_collection')); 0090 $this->addResource(new Zend_Acl_Resource ('default_funding')); 0091 0092 $this->addResource(new Zend_Acl_Resource ('default_stati')); 0093 $this->addResource(new Zend_Acl_Resource ('default_tag')); 0094 $this->addResource(new Zend_Acl_Resource ('default_section')); 0095 $this->addResource(new Zend_Acl_Resource ('default_supporters')); 0096 0097 0098 $this->addResource(new Zend_Acl_Resource ('backend_categories')); 0099 $this->addResource(new Zend_Acl_Resource ('backend_vcategories')); 0100 $this->addResource(new Zend_Acl_Resource ('backend_categorytag')); 0101 $this->addResource(new Zend_Acl_Resource ('backend_categorytaggroup')); 0102 $this->addResource(new Zend_Acl_Resource ('backend_claim')); 0103 $this->addResource(new Zend_Acl_Resource ('backend_comments')); 0104 $this->addResource(new Zend_Acl_Resource ('backend_content')); 0105 $this->addResource(new Zend_Acl_Resource ('backend_faq')); 0106 $this->addResource(new Zend_Acl_Resource ('backend_hive')); 0107 $this->addResource(new Zend_Acl_Resource ('backend_hiveuser')); 0108 $this->addResource(new Zend_Acl_Resource ('backend_index')); 0109 $this->addResource(new Zend_Acl_Resource ('backend_mail')); 0110 $this->addResource(new Zend_Acl_Resource ('backend_member')); 0111 $this->addResource(new Zend_Acl_Resource ('backend_memberpayout')); 0112 $this->addResource(new Zend_Acl_Resource ('backend_memberpaypaladdress')); 0113 $this->addResource(new Zend_Acl_Resource ('backend_paypalvalidstatus')); 0114 $this->addResource(new Zend_Acl_Resource ('backend_payoutstatus')); 0115 $this->addResource(new Zend_Acl_Resource ('backend_operatingsystem')); 0116 $this->addResource(new Zend_Acl_Resource ('backend_project')); 0117 $this->addResource(new Zend_Acl_Resource ('backend_ranking')); 0118 $this->addResource(new Zend_Acl_Resource ('backend_reportcomments')); 0119 $this->addResource(new Zend_Acl_Resource ('backend_reportproducts')); 0120 $this->addResource(new Zend_Acl_Resource ('backend_search')); 0121 $this->addResource(new Zend_Acl_Resource ('backend_storecategories')); 0122 $this->addResource(new Zend_Acl_Resource ('backend_vstorecategories')); 0123 $this->addResource(new Zend_Acl_Resource ('backend_store')); 0124 $this->addResource(new Zend_Acl_Resource ('backend_tag')); 0125 $this->addResource(new Zend_Acl_Resource ('backend_user')); 0126 $this->addResource(new Zend_Acl_Resource ('backend_tags')); 0127 $this->addResource(new Zend_Acl_Resource ('backend_ghnsexcluded')); 0128 $this->addResource(new Zend_Acl_Resource ('backend_letteravatar')); 0129 $this->addResource(new Zend_Acl_Resource ('backend_group')); 0130 $this->addResource(new Zend_Acl_Resource ('backend_spamkeywords')); 0131 $this->addResource(new Zend_Acl_Resource ('backend_projectclone')); 0132 0133 $this->addResource(new Zend_Acl_Resource ('backend_section')); 0134 $this->addResource(new Zend_Acl_Resource ('backend_sectioncategories')); 0135 $this->addResource(new Zend_Acl_Resource ('backend_sponsor')); 0136 0137 $this->addResource(new Zend_Acl_Resource ('backend_browselisttype')); 0138 0139 $this->addResource(new Zend_Acl_Resource ('backend_cdiscourse')); 0140 $this->addResource(new Zend_Acl_Resource ('backend_cgitlab')); 0141 $this->addResource(new Zend_Acl_Resource ('backend_cldap')); 0142 $this->addResource(new Zend_Acl_Resource ('backend_coauth')); 0143 $this->addResource(new Zend_Acl_Resource ('backend_cexport')); 0144 $this->addResource(new Zend_Acl_Resource ('backend_statistics')); 0145 0146 $this->addResource(new Zend_Acl_Resource ('statistics_data')); 0147 0148 $this->allow(self::ROLENAME_GUEST, array( 0149 'statistics_data' 0150 )); 0151 0152 $this->addResource(new Zend_Acl_Resource ('portal_index')); 0153 $this->allow(self::ROLENAME_GUEST, array( 0154 'portal_index' 0155 )); 0156 0157 $this->addResource(new Zend_Acl_Resource ('portal_user')); 0158 $this->allow(self::ROLENAME_GUEST, array( 0159 'portal_user' 0160 )); 0161 0162 // resource portal_user 0163 $this->allow(self::ROLENAME_GUEST, 'portal_index', array( 0164 'index' 0165 )); 0166 0167 // resource portal_user 0168 $this->allow(self::ROLENAME_GUEST, 'portal_user', array( 0169 'index' 0170 )); 0171 0172 0173 $this->allow(self::ROLENAME_GUEST, array( 0174 'default_logout', 0175 'default_authorization', 0176 'default_button', 0177 'default_categories', 0178 'default_content', 0179 'default_community', 0180 'default_donationlist', 0181 'default_error', 0182 'default_explore', 0183 'default_gateway', 0184 'default_hive', 0185 'default_home', 0186 'default_membersetting', 0187 'default_json', 0188 'default_ocsv1', // OCS API 0189 'default_embedv1', // embed API 0190 'default_productcategory', 0191 'default_rss', 0192 'default_support', 0193 'default_subscription', 0194 'default_supporterbox', 0195 'default_plingbox', 0196 'default_oauth', 0197 'default_plings', 0198 'default_gitfaq', 0199 'default_ads', 0200 'default_dl', 0201 'default_stati', 0202 'default_password', 0203 'default_verify', 0204 'default_login', 0205 'default_supporters', 0206 'default_collection' 0207 )); 0208 0209 $this->allow(self::ROLENAME_SYSUSER, array( 0210 'default_authorization', 0211 'default_button', 0212 'default_categories', 0213 'default_content', 0214 'default_community', 0215 'default_donationlist', 0216 'default_error', 0217 'default_explore', 0218 'default_gateway', 0219 'default_hive', 0220 'default_home', 0221 'default_ocsv1', // OCS API 0222 'default_embedv1', // embed API 0223 'default_productcategory', 0224 'default_report', 0225 'default_rss', 0226 'default_supporterbox', 0227 'default_plingbox', 0228 'default_oauth', 0229 'default_plings', 0230 'default_ads', 0231 'default_dl', 0232 'default_stati', 0233 'default_password' 0234 )); 0235 0236 $this->allow(self::ROLENAME_COOKIEUSER, array( 0237 'default_logout', 0238 'default_productcomment', 0239 'default_settings', 0240 'default_tag', 0241 'default_rectification' 0242 )); 0243 0244 $this->allow(self::ROLENAME_STAFF, array( 0245 'backend_index', 0246 'backend_categories', 0247 'backend_categorytag', 0248 'backend_claim', 0249 'backend_comments', 0250 'backend_content', 0251 'backend_store', 0252 'backend_storecategories', 0253 'backend_operatingsystem', 0254 'backend_reportcomments', 0255 'backend_reportproducts', 0256 'backend_search', 0257 'backend_group' 0258 )); 0259 0260 $this->allow(self::ROLENAME_ADMIN); 0261 0262 // resource access rights in detail 0263 $this->allow(self::ROLENAME_GUEST, 'backend_group', array('newgroup')); 0264 0265 // resource default_product 0266 $this->allow(self::ROLENAME_GUEST, 'default_product', array( 0267 'index', 0268 'show', 0269 'getupdatesajax', 0270 'updates', 0271 'follows', 0272 'fetch', 0273 'search', 0274 'startdownload', 0275 'ppload', 0276 'loadratings', 0277 'loadfilesjson', 0278 'loadinstallinstruction', 0279 'gettaggroupsforcatajax', 0280 'getfilesajax', 0281 'getfiletagsajax', 0282 'startvideoajax', 0283 'stopvideoajax', 0284 'startmediaviewajax', 0285 'stopmediaviewajax', 0286 'loadfirstfilejson', 0287 'loadtagrating' 0288 )); 0289 0290 // resource default_product 0291 $this->allow(self::ROLENAME_GUEST, 'default_collection', array( 0292 'index', 0293 'show', 0294 'getupdatesajax', 0295 'updates', 0296 'follows', 0297 'fetch', 0298 'search', 0299 //'startdownload', 0300 //'ppload', 0301 'loadratings', 0302 //'loadinstallinstruction', 0303 //'getfilesajax', 0304 'gettaggroupsforcatajax' 0305 )); 0306 0307 // resource default_product 0308 $this->allow(self::ROLENAME_SYSUSER, 'default_product', array( 0309 'index', 0310 'show', 0311 'getupdatesajax', 0312 'updates', 0313 'follows', 0314 'fetch', 0315 'search', 0316 'startdownload', 0317 'ppload', 0318 'loadratings' 0319 )); 0320 0321 $this->allow(self::ROLENAME_COOKIEUSER, 'default_product', array( 0322 'add', 0323 'rating', 0324 'follow', 0325 'unfollow', 0326 'plingproject', 0327 'followproject', 0328 'unplingproject', 0329 'add', 0330 'pling', 0331 'pay', 0332 'dwolla', 0333 'paymentok', 0334 'paymentcancel', 0335 'saveproduct', 0336 'claim', 0337 'votetagrating' 0338 )); 0339 0340 $this->allow(self::ROLENAME_COOKIEUSER, 'default_collection', array( 0341 'add', 0342 'rating', 0343 'follow', 0344 'unfollow', 0345 'plingproject', 0346 'followproject', 0347 'unplingproject', 0348 'pling', 0349 'pay', 0350 'dwolla', 0351 'paymentok', 0352 'paymentcancel', 0353 'saveproduct', 0354 'claim' 0355 )); 0356 0357 $this->allow(self::ROLENAME_COOKIEUSER, 'default_membersetting', array( 0358 'getsettings','setsettings','notification','searchmember' 0359 )); 0360 0361 $this->allow(self::ROLENAME_MODERATOR, 'backend_project', array( 0362 'doghnsexclude' 0363 )); 0364 0365 $this->allow(self::ROLENAME_MODERATOR, 'default_moderation', array( 0366 'index','list' 0367 )); 0368 $this->allow(self::ROLENAME_MODERATOR, 'default_duplicates', array( 0369 'index' 0370 )); 0371 $this->allow(self::ROLENAME_MODERATOR, 'default_newproducts', array( 0372 'index' 0373 )); 0374 0375 0376 0377 0378 $this->allow(self::ROLENAME_COOKIEUSER, 'default_product', array( 0379 'edit', 0380 'saveupdateajax', 0381 'deleteupdateajax', 0382 'update', 0383 'preview', 0384 'delete', 0385 'unpublish', 0386 'publish', 0387 'verifycode', 0388 'makerconfig', 0389 'addpploadfile', 0390 'updatepploadfile', 0391 'deletepploadfile', 0392 'deletepploadfiles', 0393 'updatefiletag', 0394 'getcollectionprojectsajax', 0395 'getprojectsajax' 0396 0397 ), new Default_Plugin_Acl_IsProjectOwnerAssertion()); 0398 0399 // resource default_support 0400 $this->allow(self::ROLENAME_GUEST, 'default_support', array('index')); 0401 $this->allow(self::ROLENAME_COOKIEUSER, 'default_support', array('index', 'pay', 'paymentok', 'paymentcancel')); 0402 0403 // resource default_subscription 0404 $this->allow(self::ROLENAME_GUEST, 'default_subscription', array('index', 'support2')); 0405 $this->allow(self::ROLENAME_COOKIEUSER, 'default_subscription', array('index', 'support2', 'pay', 'pay2', 'paymentok', 'paymentcancel')); 0406 0407 // resource default_report 0408 $this->allow(self::ROLENAME_COOKIEUSER, 'default_report', array('comment', 'product', 'productfraud', 'productclone')); 0409 0410 // resource default_widget 0411 $this->allow(self::ROLENAME_GUEST, 'default_widget', array('index', 'render')); 0412 $this->allow(self::ROLENAME_COOKIEUSER, 'default_widget', array('save', 'savedefault', 'config'), 0413 new Default_Plugin_Acl_IsProjectOwnerAssertion()); 0414 0415 $this->allow(self::ROLENAME_COOKIEUSER, 'default_file', array( 0416 'gitlink', 0417 'link', 0418 ), new Default_Plugin_Acl_IsProjectOwnerAssertion()); 0419 0420 // resource default_user 0421 $this->allow(self::ROLENAME_GUEST, 'default_home', array('baseurlajax','forumurlajax','blogurlajax','storenameajax','domainsajax', 'userdataajax', 'loginurlajax', 'metamenujs','metamenubundlejs','fetchforgit')); 0422 0423 // resource default_user 0424 $this->allow(self::ROLENAME_GUEST, 'default_user', array('index', 'aboutme', 'share', 'report', 'about', 'tooltip', 'avatar', 'userdataajax','showoriginal')); 0425 0426 $this->allow(self::ROLENAME_COOKIEUSER, 'default_user', array( 0427 'follow', 0428 'unfollow', 0429 'settings', 0430 'products', 0431 'collections', 0432 'news', 0433 'activities', 0434 'payments', 0435 'income', 0436 'payout', 0437 'payouthistory', 0438 'plings', 0439 'plingsold', 0440 'plingsajax', 0441 'plingsmonthajax', 0442 'downloadhistory', 0443 'likes', 0444 'funding', 0445 'sectionsajax', 0446 'sectionsmonthajax', 0447 'sectionplingsmonthajax', 0448 'sectioncreditsmonthajax', 0449 'sectionaffiliatesmonthdetailajax', 0450 )); 0451 0452 //$this->allow(self::ROLENAME_GUEST, 'default_funding', array( 0453 // 'index', 0454 // 'plingsajax', 0455 // 'plingsmonthajax' 0456 //)); 0457 0458 $this->allow(self::ROLENAME_COOKIEUSER, 'default_tag', array('filter', 'add', 'del', 'assign', 'remove')); 0459 } 0460 0461 }