Doctrine-based CodeIgniter authentication/acl system - authentication

I'm working on web app based on CodeIgniter/Doctrine. I've tested several auth libraries, but all of them use ActiveRecord. Is there a plugin/library that uses Doctrine, or can be adapted to Doctrine?! Or can I use both Doctrine and CodeIgniter in a project?!

You can adapt any auth plugin/library to use Doctrine instead of ActiveRecord. It might be a lot of work to dig through the code, but essentially you'll have to figure out what the plugin/lib is attempting to do with a record (access, modify etc) and then replicate that with a doctrine statement and return the data as expected by the plugin/lib.
I've not used any Auth library/plugin with Doctrine but I've built an ACL for my app using hooks (pre-controller or post-controller works nicely) that works with Doctrine.

Related

YII2, rest API without database connection

I have been studying how to develop a rest API with YII and everything is clear from the documentation.
In the documentation they suggest using ActiveRecord however I will have inside my application some controllers that do nothing in the database, I mean they work with vectors or files or for example complex controllers that have to update several tables in the database or make queries to other APIs to later make updates.
What do you think is the best approach to fix this?
I would like to keep the same "Bearer Token" authentication for all controllers regardless of whether it is a simple one that works with ActiveRecord or a complex one that involves other actions.
Thank you in advanced.
Public function actionExample(){
// do stuff
// $result
return json_encode($result);
}

create query using webservice api for Rally

I am trying to write a query in Ruby to insert a user story in Rally using WSAPI. I read through https://rally1.rallydev.com/slm/doc/webservice/.I looked it up and found that wsapi has a create() method, but I am not aware of its signature. I know it uses PUT/Post method for creation, but I just need an example to understand how to write create queries. Does anyone know of any useful resource to know more about this? I have all my code ready, just need information about writing "create" queries using Rally's WSAPI.
Thanks
There is a full directory of Ruby REST examples in the Github Repository for RallyRestToolkitForRuby:
https://github.com/RallyTools/RallyRestToolkitForRuby/tree/master/examples
This create example may be of particular interest. It's for a Defect, but the same logic would apply to Stories:
04-create-defect.rb

Yii Cdbmessage translation - CRUD

In Yii framework, is there is any plugin/ module which do the CRUD operations for Cdbmessage source translations?
I think you have a lot of choise, you can try one of these:
http://www.yiiframework.com/extension/translate/ or http://www.yiiframework.com/extension/ei18n/
Also I can offer TsTranslation TsTranslation extension.
It allow
create and update dynamic content in different languages,
get text using syntax Yii::t($model, 'attribute'),
translate texts via Google Translate and more
DEMO and documentation: http://tstranslation.sundevelop.com/

Kohana 3 auth username as number

I want to use numbers as username in Kohana Auth. For example, username 100001?
While adding new user Kohana returns me error: ORM_Validation_Exception [ 0 ]: Failed to validate array
Is is possible to user numbers as username in Kohana?
EDIT: This answer looks simpler and better than mine, but try to understand it at all.
You need to extend User Model, I'll help you using auth with the ORM driver.
Steps to extend User Model:
If you didn't yet, configure Auth module to use orm and create a database table with the fields you want. Here is a good example of how to doing it (It's an old tutorial using ko3.1 but you can still learn from it). PS.: you can have any columns at the 'users' table and you don't need to have the 'username' column if you do not want.
Open and read carefully this file: MODULES/orm/classes/model/auth/user.php (It's self documented and I hope you understand it. If not, stop reading this answer here and read the kohana docs. Some shortcuts: Auth - Kohana User Guide, Auth (orm) methods, addons:auth
Copy the file (don't edit the original) to APPPATH/classes/model/auth/user.php and edit it how you want. Some functions that you may like to edit are: rules, filters and unique_key (<- useful). Be creative, you also can add custom functions.
Test and change whatever else needed.
You can change the login method to works as you like. You can set login by e-mail, make a custom validation method or parse values before saving in the database (see public function filters()). This is helpful for whatever you try to do with auth module using ORM... But... if you really don't want to use ORM, you can build your own driver, learn how.
I made this some time ago in kohana 3.2 but I think you won't get problems with 3.3. If you still have questions, this question on kohana forum may help.

YII how to get data from another`s session?

I need a UI to manage all app sessions. How could I retrive data from foreign sessions? Im interested in getting data set bysetState` function during other users login.
I'm using CDbHttpSession for storing sessions in DB
So, i found answer, but it isnt good in my opinion. But maybe it will be helpfull for others. Yii stores data in session table using php built in session serialization method (it isnt regular serialize function). And only way that i found to work with it is suggested on the php session_decode manual page in the comments.