开发者

Codeigniter: how do I roll out features to controlled (beta) groups of users?

Explanation

I'm working on a web application build in CodeIgniter. Since I'm continuously adding new features, some of them might be unstable. Therefore I would like to have a way of 'rolling out' these features to specified groups first. If all goes well I would make the feature available for the full user community.

The solution I'm thinking of now consists of a config file that has feature arrays in them for every release group:

alpha = array(
    "feature A" => true,
    "feature B" => true,
    "feature C" => true
    );

beta = array(
    "feature A" => true,
    "feature B" => true,
    "feature C" => false
    );

pro开发者_如何学运维duction = array(
    "feature A" => false,
    "feature B" => false,
    "feature C" => false
    );

The users in my application are then divided into groups (alpha, beta, production) and the system would make the applicable features available for the current user.

This part of 'making available the applicable feature' I'm now thinking about doing with a (ugly) construction as the following:

if ($feature_array["feature A"])
{
   /* run the code for feature A */
}

Thing with that construction is, though, that if the feature is rolled out to all the users this code is no longer necessary but will still sit there.

My question

Is there a solution/standard setup/library for this kind of functionality and avoids me having to go back and delete these 'if statements' when a feature is fully rolled out?


It's very basic but have a look at Turnstyles.


I'd personally look to developing a role based authentication system

not sure if there are any in production already, but essentially you would use a table containing roles, assign each member a specific role (or user level, if you prefer)

then you can just dish out appropriate features in your business logic in your controller/model.

once a feature passes beta stage, you can just update the roles for every one so that they have access.

(It's quite a bit of work from scratch to do it right, but depending on how extensible you want it it may be worth doing).

you may also consider an ACL - CI has several existing solutions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜