@@ -114,24 +114,24 @@ public function getRequestContext()
114
114
*/
115
115
public function checkRight ($ _right , $ _throwException = TRUE , $ _includeTinebaseAdmin = TRUE )
116
116
{
117
- if (empty ($ this ->_applicationName )) {
118
- throw new Tinebase_Exception_UnexpectedValue ('No application name defined! ' );
119
- }
120
117
if (! is_object (Tinebase_Core::getUser ())) {
121
118
throw new Tinebase_Exception ('No user found for right check! ' );
122
119
}
123
120
124
121
$ right = strtoupper ($ _right );
125
-
122
+ $ applicationRightsClass = $ this ->_getApplicationRightsClass ();
123
+ $ rightsApp = substr ($ applicationRightsClass , 0 , strpos ($ applicationRightsClass , '_ ' ));
124
+ if (empty ($ rightsApp )) {
125
+ throw new Tinebase_Exception_UnexpectedValue ('No application name defined! ' );
126
+ }
127
+
126
128
$ cache = Tinebase_Core::getCache ();
127
129
$ cacheId = Tinebase_Helper::convertCacheId (
128
- 'checkRight ' . Tinebase_Core::getUser ()->getId () . $ right . $ this -> _applicationName
130
+ 'checkRight ' . Tinebase_Core::getUser ()->getId () . $ right . $ rightsApp
129
131
);
130
132
$ result = $ cache ->load ($ cacheId );
131
-
133
+
132
134
if (!$ result ) {
133
- $ applicationRightsClass = $ this ->_getApplicationRightsClass ();
134
-
135
135
// array with the rights that should be checked, ADMIN is in it per default
136
136
$ rightsToCheck = ($ _includeTinebaseAdmin ) ? array (Tinebase_Acl_Rights::ADMIN ) : array ();
137
137
@@ -142,15 +142,15 @@ public function checkRight($_right, $_throwException = TRUE, $_includeTinebaseAd
142
142
143
143
$ rightsToCheck [] = constant ($ applicationRightsClass . ':: ' . $ right );
144
144
145
- $ result = FALSE ;
145
+ $ result = false ;
146
146
147
147
foreach ($ rightsToCheck as $ rightToCheck ) {
148
148
if (Tinebase_Acl_Roles::getInstance ()->hasRight (
149
- $ this -> _applicationName ,
149
+ $ rightsApp ,
150
150
Tinebase_Core::getUser ()->getId (),
151
151
$ rightToCheck
152
152
)) {
153
- $ result = TRUE ;
153
+ $ result = true ;
154
154
break ;
155
155
}
156
156
}
@@ -159,7 +159,9 @@ public function checkRight($_right, $_throwException = TRUE, $_includeTinebaseAd
159
159
}
160
160
161
161
if (!$ result && $ _throwException ) {
162
- throw new Tinebase_Exception_AccessDenied ("You are not allowed to $ right in application $ this ->_applicationName ! " );
162
+ throw new Tinebase_Exception_AccessDenied (
163
+ "You are not allowed to $ right in application $ rightsApp ! "
164
+ );
163
165
}
164
166
165
167
return $ result ;
@@ -343,8 +345,10 @@ public function getModels($MCV2only = false)
343
345
344
346
if ($ MCV2only ) {
345
347
if (! Setup_Core::isDoctrineAvailable ()) {
346
- if (Tinebase_Core::isLogLevel (Zend_Log::WARN )) Tinebase_Core::getLogger ()->warn (__METHOD__ . ':: ' . __LINE__
347
- . ' Doctrine not available, could not get modelconfig v2 models for application (php version id: ' . PHP_VERSION_ID . ') ' );
348
+ if (Tinebase_Core::isLogLevel (Zend_Log::WARN )) {
349
+ Tinebase_Core::getLogger ()->warn (__METHOD__ . ':: ' . __LINE__
350
+ . ' Doctrine not available, could not get modelconfig v2 models for application (php version id: ' . PHP_VERSION_ID . ') ' );
351
+ }
348
352
return array ();
349
353
}
350
354
0 commit comments