Skip to content

Commit

Permalink
check for admin name update
Browse files Browse the repository at this point in the history
  • Loading branch information
ssm2017 committed Mar 9, 2010
1 parent 8d61771 commit 76a7dcf
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 9 deletions.
10 changes: 7 additions & 3 deletions readme
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
D4os is a set of modules to manage an OpenSim grid using drupal.
more infos : http://groups.drupal.org/d4os

***** THIS IS AN ALPHA STAGE USE IT AT YOUR OWN RISK AND NOT IN A PRODUCTION SITE *****

***** ⚠ Actually d4os is using the OpenSim 0.6.8 database schema ⚠ *****

****************
Installation :
****************
* install OpenSim in grid mode using mysql as datastore
* if you want to use search and groups, use the link http://d4os.yourdomain.com/services/xmlrpc in your OpenSim.ini [search] and [groups] section
* if you want to use search, profile and groups, you need to import the sql files from these modules in your database (d4os is not creating these tables. The sql files can be found in their own projects on the OpenSim forge)
* if you want to use search, profile and groups, use the link http://d4os.yourdomain.com/services/xmlrpc in your OpenSim.ini [search] [profile] and [groups] sections
* extract the archive in your drupal modules folder (sites/all/modules)
* go to you modules admin page and enable the modules (admin/build/modules)
* go to the d4os admin pages and set the values to fit your OpenSim installation (admin/settings/d4os)
Expand All @@ -16,6 +19,7 @@ Installation :
****************
dependencies :
****************
* you can use the search and groups services independantly
* but if you want to use the groups in the website, you need to install the module called "og" (http://drupal.org/project/og)
* you can use the search and groups services independantly (io), but to use them, you need to install the module called "services" and enable "xmlrpc server" (http://drupal.org/project/services)
* if you want to use the groups in the website (ui), you need to install the module called "og" (http://drupal.org/project/og)
* if you want to use the events in the website, you need to install the module called "date-api" (http://drupal.org/project/date)
* if you want to use the stats levels, you need to install the module called "libraries" (http://drupal.org/project/libraries)
3 changes: 2 additions & 1 deletion ui/d4os_ui_auth/d4os_ui_auth.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ name = "d4os ui auth"
description = "Provides tools to manage regions in an opensim grid."
package = d4os ui
core = 6.x
dependencies[] = d4os
dependencies[] = d4os
dependencies[] = d4os_ui_users
2 changes: 1 addition & 1 deletion ui/d4os_ui_auth/d4os_ui_auth.module
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function d4os_ui_auth_login_validate($form, &$form_state) {

// set the username
$admin = user_load(1);
if ($form_state['values']['username'] == $admin->name) {
if ($form_state['values']['lastname'] == $admin->name) {
$form_state['values']['name'] = $admin->name;
$login_flow = 0;
}
Expand Down
2 changes: 2 additions & 0 deletions ui/d4os_ui_events/d4os_ui_events.info
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name = d4os ui events
description = Links the event module with opensimulator.
package = d4os ui
dependencies[] = d4os
dependencies[] = date_api
core = 6.x
1 change: 1 addition & 0 deletions ui/d4os_ui_groups/d4os_ui_groups.info
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name = d4os ui groups
description = Provides a link between inworld groups and og.
package = d4os ui
dependencies[] = d4os
dependencies[] = og
core = 6.x
3 changes: 2 additions & 1 deletion ui/d4os_ui_stats/levels/d4os_ui_stats_levels.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ name = "d4os ui stats levels"
description = "Provides tools to display stats for an opensim grid."
package = d4os stats
core = 6.x
dependencies[] = d4os
dependencies[] = d4os
dependencies[] = libraries
26 changes: 23 additions & 3 deletions ui/d4os_ui_users/d4os_ui_users.module
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ function d4os_ui_users_account_validate($form, &$form_state) {
$lastname = $form_state['values']['lastname'];
$name = $form_state['values']['username']. ' '. $form_state['values']['lastname'];

// check if the lastname is the same one as admin account
$admin = user_load(1);
if ($lastname == $admin->name) {
form_set_error('lastname', t('Please use another lastname.'));
}

// rebuild the "name" for drupal account
$form_state['values']['name'] = $name;

Expand Down Expand Up @@ -538,7 +544,10 @@ function d4os_ui_users_grid_form($account) {
}
return $form;
}
function d4os_ui_users_check_users() {
function d4os_ui_users_check_users() {
// get the admin account
$admin = user_load(1);

// get drupal users
$website_users = array();
$result = db_query('SELECT * FROM {users}');
Expand All @@ -551,7 +560,13 @@ function d4os_ui_users_check_users() {
// check if drupal users are in the grid base
$not_in_grid = array();
foreach ($website_users as $website_user) {
$name = $website_user->name;
$name = $website_user->name;
// check if the user has the same lastname as admin account
$names = explode(' ', $website_user->name);
if ($names[1] == $admin->name) {
drupal_set_message(t('The website user called !name has the same lastname as admin account.', array('!name' => $name)), 'error');
}
// check if the name exists in website
if ($website_user->uid > 1 && d4os_array_search_recursive($name, $grid_users) === NULL) {
$not_in_grid[] = $website_user;
}
Expand All @@ -560,7 +575,12 @@ function d4os_ui_users_check_users() {
// check if grid users are in the drupal base
$not_in_website = array();
foreach ($grid_users as $grid_user) {
$name = $grid_user->name;
$name = $grid_user->name;
// check if the user has the same lastname as admin account
if ($grid_user->lastname == $admin->name) {
drupal_set_message(t('The grid user called !name has the same lastname as admin account.', array('!name' => $grid_user->name)), 'error');
}
// check if the name exists in website
if (d4os_array_search_recursive($name, $website_users) === NULL) {
$not_in_website[] = $grid_user;
}
Expand Down

0 comments on commit 76a7dcf

Please sign in to comment.