Yii 1.1: bum

Basic User Management
18 followers

Basic User Management (BUM) module aims to be a simple and easy to use module, but in the same time a powerful one in managing users. The module does not intend to "reinvent the wheel", so whenever a task not related with user management is needed, it make use of other great modules (like yii-mail and/or RBAM). This module has a simple and intuitive administration panel and response to basic user administration needs. Enjoy it.

Feedback is welcomed. :)

Requirements

  • Require Yii 1.1 or above.
  • yii-mail extension

What BUM has to offer

  • users login (using their user name or email address);
  • facebook users login;
  • twitter users login;
  • associate facebook logIn to an existing user;
  • associate twitter logIn to an existing user;
  • user status code (block user access, facebook only, twitter only, normal, special...);
  • activate/deactivate user (users may activate their account by email, clicking on an activate link );
  • manage user (create/update/delete users);
  • view all users (in two different ways);
  • singUp;
  • invite friends;
  • user profile;
  • user private profile;
  • customize some settings (like: allow users to log in if they are not active; is signUp enabled; customise invitation email .... );
  • password reset syste;
  • resend activation link;
  • associate many emails to an user account (with email verification);

Usage

  • Download and extract the extension package to protected/modules/bum directory of your application.
  • See the documentation at :bum online documentation for more configuration options and a short installing tutorial.
  • From v3 facebook login is enabled; insert facebook login button by using BUM widget:
$this->widget('facebook_app', array(
          'appId'=>Yii::app()->getModule('bum')->fb_appId,
          'secret'=>Yii::app()->getModule('bum')->fb_secret,
          'text'=>'Sign in with <b>Facebook</b>',
          'target'=>'_self',
       ));

in settings you may save your facebook appId and secret. - twitter login is enabled; insert twitter login button by using BUM widget:

$this->widget('twitter_app', array(
          'text'=>'Sign in with <b>Twitter</b>',
          'target'=>'_self',
       ));

in settings you may save your twitter customer key and secret.

Resources

Change log

2013-09-04 - twitter login button; DATABASE CHANGES

2013-09-02 - show if users enabled facebook logIn (on: Manage Users, View all Users and View Private Profile pages)

2013-08-29 - main update: add FACEBOOK login button DATABASE CHANGES - other small updates...

2013-07-19 - add the possibility to customize email sent by this application (new button in settings area). see: DATABASE CHANGES

2013-06-03 - minor improvement: add a property that allows to update DATETIME statistical fields without the use of triggers; - minor BUG fix: please in all tables where TIMESTAMP is defined as not null, ALTER table to make it default as NULL and with no ATTRIBUTES or EXTRA... (DATETIME fields are used just for statistical reasons so no harm if nothing is done);

2013-05-31 - fix script src links (to point at the last sql version; in install tutorial) - focus on the user name in logIn page

2013-05-21 - add password reset capability; A user can reset his/hers password base on user name (or email address), a captcha and a verification email with secret a code. see: DATABASE CHANGES

2013-04-04 - fix "setting load" bug; (settings were not loaded form the database) - add new column to the settings table; see DATABASE CHANGES

2013-04-03 - Add password_change right: With this right user can change the password without knowing the old password. - On install defaults operations/tasks/roles can now be updated, not only created! (This thing is useful if a new operation/task/role has been created.)

2013-03-05 - Version 2 is available; Major improvements: invitations, see demo pages..

2012-12-08 - Modify php code to be compatible with php versions older than 5.4.

Total 20 comments

#15477 report it
firefly at 2013/11/13 06:09pm
invitation email

Dear Giles,

Sorry about the tone, it's just that I think that the problem is not related to BUM extension. Basically what configuration you have made to yii-mail in that separate project, the same configuration you have to do within BUM project.

I highlighted where BUM is using yii-mail (for sending invitation emails) in order to see if maybe you had a different approach and there is something that can be changed. I have tested the extension (and you can tested it as well at: http://social-test.infoprofessional.ro) and it's working.

Maybe you should double check XAMPP configuration. Locally, for example, in my development environment, emails are sent/printed in C:\xampp\mailoutput folder. (in php.ini see line:

; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the C:\xampp\mailoutput folder
sendmail_path = "C:\xampp\mailtodisk\mailtodisk.exe"

)

#15468 report it
Giles at 2013/11/13 06:59am
Transport Options / Send Mail Error

Hey firefly, thanks for your fast response.

So I guess by the tone of your response that you don't normally get asked this question ... this leads me to think that I'm asking the wrong question (plus I've tried your suggestion and Bum still fails to successfully send mail).

Maybe I should rephrase it ... I've performed a normal install (as your guidelines) currently running on XAMPP which successfully passes SMTP mail onto gmail. What steps should I now take to try find the issue.

may thanks

#15462 report it
firefly at 2013/11/12 08:19pm
Transport Options

Well if you want to change the transportOption of yii-mail module, when include this module in your application (see step 3) just set this option as you like:

step 3:

// autoloading model and component classes
'import'=>array(
    ...
    'ext.yii-mail.YiiMailMessage', // module yii-mail is required in order to sent confirmation email to the users
 
    'application.modules.bum.models.*',
    'application.modules.bum.components.*',
),
...
'modules'=>array(
    ...
    // Basic User Management module;
    'bum' => array(
        // needs yii-mail extension..
 
        'install'=>true, // true just for installation mode, on develop or production mode should be set to false
    ),
    ...
);
...
// application components
'components'=>array(
    ...
    'user'=>array(
        ...
        'class' => 'BumWebUser',
        'loginUrl' => array('//bum/users/login'), // required
        ...
    ),
 
    ...
 
    'authManager'=>array(
        'class'=>'CDbAuthManager',
        'connectionID'=>'db',
    ),
    ...
    // required by bum module
    'mail' => array(
        'class' => 'ext.yii-mail.YiiMail', //  module yii-mail is required in order to sent confirmation emails to the users
        'transportType' => 'php',
        'transportOptions'=>array(
                  'host'=>'smtp.gmail.com',
                  'port_secure'=>true,
                  'enc_tls'=>true,
                  'username'=>'XXXXXXX',
                  'password'=>'XXXXXXX',
                  'port'=>587,
            ),
        'viewPath' => 'bum.views.mail',
        'logging' => false,
        'dryRun' => false,
    ),
    ...
),

If you want to see how BUM is sending invitation emails, check the following code: bum/controllers/InvitationsController.php line 156 sendInvitationEmail($model) and lines 122, 123 of actionAJAXCreate($processOutput = false).

The message displayed by bum module when email was successfully sent is: "Invitation sent!"; there is no "page at localhost says invitation sent" message.

#15460 report it
Giles at 2013/11/12 06:04pm
Transport Options

Hi,

Do I need to set transportOptions anywhere? I've followed your installation tutorial. If I try sending an invite (for example) I get the message "page at localhost says invitation sent" but nothing gets to gmail (that I'm using as the host).

I double checked by running yii-mail in isolation and it works fine, so I'm wondering if I'm missing anything?

Many Thanks

#15403 report it
firefly at 2013/11/06 11:09pm
new feature

After successfully signUp (on activation) a thank you email is sent to the new user.

In settings you may enable or disable this feature. (see last version on github: https://github.com/6firefly/BUM)

#15118 report it
mikeklon at 2013/10/08 10:19pm
Resend Confirmation / Reset Password Errors

@firefly

Thank you for the reply about Integrating BUM and for posting the "How-to". I was hoping for something different, but I think you answered my question about what is available. I'm going to put this issue on hold for a bit. I want to do some experimenting and research on my own and I'll give you feedback later. I don't know how fast that will come -- might be a while. I'll move this thread to the forum.

In the meantime, I tried to use the Resend Confirmation Email (on the SignUp form) and Reset Password (on the Login form) buttons. Both are giving unexpected results. See errors at:

User Registration Demo

(I will move the rest of this comment to the forum as well.)

#15110 report it
firefly at 2013/10/08 08:26am
Adding New Data to a User

@mikeklon

Does this article answer your question?

http://www.yiiframework.com/wiki/574/bum-add-additional-info-to-a-user/

#15073 report it
mikeklon at 2013/10/04 09:08pm
Integrating BUM

@firefly

Thank you very much for the FaceBook and Twitter explanation. Bravo once again.

Regrading my "integration" question -- the BUM module tables have specific fields for each user that can be updated by that individual user (password, name, email, etc). However I have an existing design with an existing user table and model with additional fields unknown to BUM. I would like a user to be able to update those as well.

Should I extend and/or modify the existing BUM class(es), modify the existing user_data table and model, or employ some sort of filter in the existing models/controllers to incorporate different table data with the BUM module. Is there existing documentation or tutorial for accomplishing this cleanly?

xNicox mentions extending Auth with BWebUser in post #13543. I wonder if s/he would share his/her procedure and or design thoughts?

Thank you again for all your help. You have been terrific!

#15070 report it
firefly at 2013/10/04 11:41am
facebook & twitter

@mikeklon

Register to facebook, go to https://developers.facebook.com/apps, create a new app. After completing the required form, you will receive an "App ID/API Key" and a "App Secret". Insert those two in: Settings (bum/settings/batchUpdate) of BUM module, in "Facebook App ID" and "Facebook secret" fields.

For twitter: go to https://dev.twitter.com/apps, create a new application, and after completing the form, you will receive a "Customer key" and a "Consumer secret"; this should be inserted in: Settings (bum/settings/batchUpdate) of BUM module, in "Twitter Consumer key" and "Twitter customer secret" fields.

As for integrating this module with an existing application, I don't really understand your request; if you have successfully installed BUM with a fresh new yii app, then I suppose that you should follow the same steps for an existing application...

10x for feedback ;)

#15065 report it
mikeklon at 2013/10/04 12:39am
Facebook & Twitter

I was able to get the BUM working. Its available at bum100.mikeklonecki.com if you want to see.

Now I know virtually nothing about Facebook and Twitter. When I click those buttons (on the login page), some weird results are displayed. Clicking the Facebook link returns:

unknown app ***.

Try the example at bum100.mikeklonecki.com

It just so happens that *** is what is entered for Facebook (and Twitter) on the Admin->Settings page (by default).

My question is what do I need to do to get those to work? Do I need to modify those fields and if so, what goes in?

Thanks again for helping out a rookie.

#15063 report it
mikeklon at 2013/10/03 11:48am
Step 4 and 5

@ firefly:

roles, tasks and operations

Thank you for the feedback on how to do Step 4 and 5. I must have unwittingly done just that because subsequent to posting my note, I was able to login as admin/demo and perform the expected operations. Bravo for including the links.

Just as feedback, it was not intuitive (at least for a rookie like me) as to what I was supposed to do on those steps. Perhaps update instructions:

Insert a new step 4 where you say: modify the main menu as shown in your example at the bottom of the page, then launch the site, www/webroot/<name of site>.

Move the current step 4 to step 5, current step 5 to step 6, etc.

The real feedback here is that I didn't realize I was supposed to be running the links from my own web page, although in hind site -- duh! Maybe I'm being too picky! LOL

Thank you again for all your help! Bravo again. Good Luck!

Now I have the task to integrate this nice module with an existing app. Do you have any suggested reading or perhaps know of a step-by-step example or tutorial? I have been through the blog tutorial and User Auth stuff.

p.s. I thought I had posted this response previously on 10/1/13, but it never showed up so if this is a duplicate - I apologize.

Best regards, Mike K.

#15046 report it
firefly at 2013/10/01 09:54am
roles, tasks and operations

@mikeklon

Step 4 should be easy; click on the "create/update role/tasks/operations" link, just at the end of step 4 paragraph. The required roles, tasks and operations would be automatically created by the application, vie an AJAX call. (install property should be set to true for this step to work.)

Same is true for step 5: if you click on "create default users" the default users would be automatically created (user: admin; password: admin as SuperAdmin and user: demo with password: demo as a regular user).

BUM does not aim to be a Role-Based Access Control Manager, but yii has a lot of extensions that are doing just this, in case you wish to customise your users rights.

As for CDbCommand error, I gooled for "\xE2\x80\x8F" :) and I found that in UTF-8 it is RIGHT-TO-LEFT MARK character, and I also found this post that treat the same problem :p ...

10x for feedback; hope that this extension will help you.

#15036 report it
mikeklon at 2013/09/30 11:33pm
SuperAdmin roles

@firefly

Thank you for your suggestion on the CDbCommand error. Your solution seems to have cleared the CDbCommand error. From the error message, I would never have known to check the collation. How did you know the problem was there?

I'm now kind of stuck on step 4 - setting up the roles for SuperAdmin. Is that done in the accessRules method or somewhere else? Might there be step-by-step instructions for that?

Thank you again for all the help. Best regards,

Mike K.

#15026 report it
firefly at 2013/09/30 04:47am
CDbCommand error

I suppose you don't have UTF-8 collation set for your tables in database. Check database default collation (should be UTF8), then table collation and collation of column "subject" in table "site_emails_content".

I hope this helps..

#15008 report it
mikeklon at 2013/09/28 02:41am
CDbCommand error on initial install

I downloaded and installed the module (bum.v3.02.zip) and then the yii-mail extension per the instructions on a fresh Yii installation, then ran the prescribed MySQL scripts. After modifying protected/config/main.php and protected/views/layouts/main.php as prescribed by the instructions, then trying to load the page, the following error is being thrown:

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xE2\x80\x8F' for column 'subject' at row 1. The SQL statement executed was: INSERT INTO site_emails_content (name, subject, body, available_variables, version) VALUES(:name, :subject, :body, :available_variables, :version)

I get the same error setting 'install' to both true or false.

MySQL version is 5.6.13

There are three entries in the site_emails_content table, namely sender_invitation, _signUp, and _registerNewEmail.

Is this coming from the yii-mail extension or the bum module? I've run out of ideas on what to try or where to look next. Did I download the correct file? Any help is appreciated.

Thanks, Mike K.

#14679 report it
firefly at 2013/09/03 05:10am
github

I am thinking to move the download files exclusively on github.com see: https://github.com/6firefly/BUM

#13547 report it
xNicox at 2013/06/05 08:41am
RE: user permission extensions

hi fireFly, I extended Auth WebUserClass with to BWebUser and it work for now.

The reason I choose Auth extension is because is one that include a "Filter", so whenever I start to create controllers in my app, I just change template and and a line on filter method. And I have the authorization module ready to run !

I found two extension that have filter methods; Auth and Crudge.

Rights and RBAM, I think it don't have it. Of RBAM I'll miss automatic auth generation.

Best regards

PS: Sorry for my english.

#13543 report it
firefly at 2013/06/05 04:49am
user permission extensions

1.

I see no problem in extending BumWebUser from AuthWebUser of Auth extension or the other way around, but at updates you should always be careful to do it again..

For now BumWebUsers has some methods: getStatus(), getPrimaryEmail(), getActive(), getStatusText(), loadUser() that are in no conflict with AuthWebUser class methods: getIsAdmin(), setIsAdmin(..), checkAccess(). So give it a try and tell me how it works..

2.

If you do not want to have problems with updates, you might try something like multiple inheritance and create your own User class..

3.

Or you could also try the RBAM extension, I'v tested BUM and RBAM and are working fine...

#13529 report it
xNicox at 2013/06/04 07:42am
integration with yii-Auth

hi, again, I'm trying to use this extension with Auth module.

But I have an issue on "user" component. Both modules ( bum and Auth ) overrrides "User" class component, and when I configure it for Auth, BUM doesn't work , and when I configure it for BUM, Auth doesn't work.

This is Auth configuration:

'user' => array(
      'class' => 'auth.components.AuthWebUser',
      'admins' => array('admin', 'foo', 'bar'), // users with full access
    ),

This is BUM configuration:

'user'=>array(
        ...
        'class' => 'BumWebUser',
        'loginUrl' => array('//bum/users/login'), // required
        ...
    ),

Any suggestion ? I don't know if ok if BumWebUser class extend AuthWebUser ? or viceversa ?

Best Regards

#13528 report it
xNicox at 2013/06/04 07:35am
triggers

Thanks firefly, i'll give it a try ! Best Regards

Leave a comment

Please to leave your comment.

Create extension