Private Networks
Breakout can be customized for private use, either in an intranet or as a closed group on the internet. This document explains the way private network features work.
- First of all, we need to set :private_network => true in config/environments/user_environment.rb. This will enable the private network features for all of the application.
- When a private network is enabled, when the user clicks on "Register", he is taken to UserController#private_signup?. The functionality of a private signup is quite different from regular signup, so this method is used.
- When a new user registers on a private network, he will be taken to an "Awaiting Approval" page, and an email will be sent to the administrator of the site (currently the "super" user) giving him an option to deny or accept the registration. The user will also get a mail indicating that his approval is pending. The user will not be able to log into the system unless he has been approved by an administrator.
- The administrator can either accept/deny the registration from the mail, or he can log into his account, where the number of users pending is indicated in the 'start' page. Clicking on the number of users will take him to the user/moderate page, where he can accept or deny new registrations.
- When a user is approved, he will recieve a mail indicating the same and he will be allowed to login and use the system. A rejected user also will get a mail saying that he has been denied access to the system.
Customization
This feature allows us to add custom templates to a private network.Each custom installation will have its templates in http://tools.assembla.com/svn/breakout/custom/xyzco. Where xyzco is the company the customization is being done for. Checkout the company specific directory as your top-level directory. So if you're working with trunk, the layout will look like this:
-- xyzco -- trunk
Now, cd to trunk and run rake deploy_custom_files. This will check the xyzco directory for any custom files/templates and copy them over to trunk in their respective places. Now you can deploy the private network. In case you make any further changes to the copied custom templates, you can copy those changes back to xyzco directory by running rake sync_custom_files. Remember to commit these copied over changes in xyzco directory to svn. Unless you have created some new files or images for the custom installation, you would be dealing with two files: custom.css and user-custom.css. Putting all custom css changes here avoids the problem of accidentally committing changed templates to trunk.
Extra Fields
This feature is a complementary feature to Private Networks, though it can be used independently. This field defines that the extra fields should be shown, which are part of the users table and were added recently. This would include title, address1, address2, city, zip and country. This feature is set by the variable :extra_fields in user_environment.rb However, instead of setting just to true or some other value, this variable needs to be set with the validations you want to do on your User object as a hash:
:extra_fields => { :address1 => :validates_presence_of,
:zipcode => :validates_presence_of }
Make sure that the left hand side always contains the column names and right hand side should be the validation. The above piece of code will dynamically add validations to the 'User' class, which will come into effect immediately. If you want the extra fields to be shown and add no validations, then you can pass and empty has to :extra_fields like this:
:extra_fields => {}