Beispiel #1
0
  /**
   * Authentication by array
   *
   * @param TlalokesRegistry $reg
   */
  public static function validate ( TlalokesRegistry &$reg )
  {
    if ( count( $_SESSION['profiles'] ) >= 1 ) {

      // check if role is enabled
      $roles = AuthRolesBss::getByPK( $_SESSION['role'] );
      if ( is_string( $roles ) ) {
        tlalokes_error_msg( $roles );
      } else {
        if ( $roles['role_status'] == 0 ) {
          tlalokes_error_msg( 'Authentication: Your role is not enabled' );
        }
      }
      // check if controller is available in profile
      foreach ( $_SESSION['profiles'] as $profile ) {

        // get permission
        $p = AuthAccessPermissionsBss::getByCtl( $reg->conf['current']['controller'], $profile );
        if ( !is_string( $p ) ) {
          // validate method access
          $methods = explode( ',', $p['methods'] );
          foreach ( $methods as $method ) {
            if ( $reg->conf['current']['action'] == $method ) {
              tlalokes_error_msg( 'Authentication: Your profile has no '.
                                  'access to this action' );

            }
          }
        }
        unset( $p );
      }
    }
  }
 /**
  * Edit AuthRoles
  *
  * @ActionDefinition( layout='auth_layout.tpl', zone='content:roles_edit;', propel )
  */
 public function edit ()
 {
   $this->response->_id = $this->request->_id;
   $response = AuthRolesBss::getByPK( $this->request->_id );
   if ( is_array( $response ) ) {
     $this->add();
     $this->response->element = $response;
   } else {
     $this->response->exception = $response;
   }
 }