Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling features for specific users #27

Open
altaha opened this issue Nov 19, 2015 · 1 comment
Open

Enabling features for specific users #27

altaha opened this issue Nov 19, 2015 · 1 comment

Comments

@altaha
Copy link

altaha commented Nov 19, 2015

The feature set for gutter is pretty suitable for rolling out a feature to groups of users, or of course as a global on/off feature toggle. But if you want to enable a feature for specific users, the only way I can see gutter supporting that is by adding a condition for each user you want the switch to be active for. I imagine this becomes very slow if you want it enabled for say a thousand users in beta testing.

Am I missing something here, or is this usecase not well suited to gutter?

Thanks!

@Fluxx
Copy link
Contributor

Fluxx commented Nov 19, 2015

The gutter API is pretty flexible for whatever you wanted to do - it's all just Python.

To match a known set of user IDs, you'd just need to make an operator that inherits from the Base operator. That operator, i.e. called ContainedIn, would just need to implement the applies_to method to check if the argument is contained within the collection ContainedIn would be constructed with.

class ContainedIn(Base):

    name = 'contained_in'
    group = 'comparable'
    preposition = 'contained in'
    arguments = ('value',)

    def applies_to(self, argument):
        return argument in self.value

    def __str__(self):
        return 'contained in "%s"' % self.value

The API would look something like:

users = {1,2,42,}
operator = 
condition = Condition(argument=UserArgument, attribute='id', operator=ContainedIn(users))

You can retrieve your users collection however you want - DB, Redis, hard coded, etc. Each option has tradeoffs though, so you should choose what is right for your use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants