summaryrefslogtreecommitdiff
path: root/scire
diff options
context:
space:
mode:
authorPreston Cody <codeman@gentoo.org>2007-03-26 01:43:07 +0000
committerPreston Cody <codeman@gentoo.org>2007-03-26 01:43:07 +0000
commitd717248794fa8e3dde8af10fe007d670b2f90901 (patch)
tree7cde8c5c563e49fec5f581715baaaad0b2ecf9d7 /scire
parentJust removed some comments cruft from the server modules. (diff)
downloadscire-d717248794fa8e3dde8af10fe007d670b2f90901.tar.gz
scire-d717248794fa8e3dde8af10fe007d670b2f90901.tar.bz2
scire-d717248794fa8e3dde8af10fe007d670b2f90901.zip
some larger structural changes here.
userid, clientid, and permid are no-longer auto_increment values they instead will take their IDs from the gacl ids assigned. this makes linking between the tables much easier since the ids will always be the same. (no more lookups) also adding a bare_scire.sql file with a minimal setup this combines scire.sql and scire2.sql svn path=/; revision=190
Diffstat (limited to 'scire')
-rwxr-xr-xscire/.lib/DB_functions.php12
-rw-r--r--scire/admin.php4
-rwxr-xr-xscire/assign_permission.php4
-rwxr-xr-xscire/client.php7
-rwxr-xr-xscire/ui_permissions.php5
-rwxr-xr-xscire/user.php6
6 files changed, 18 insertions, 20 deletions
diff --git a/scire/.lib/DB_functions.php b/scire/.lib/DB_functions.php
index f956c29..0966e7d 100755
--- a/scire/.lib/DB_functions.php
+++ b/scire/.lib/DB_functions.php
@@ -72,11 +72,11 @@ function get_scire_client($clientid) {
}
}
-function scire_add_client($digest, $hostname, $mac, $ip, $profileid, $osid, $contact, $status, $installtime, $assetid) {
+function scire_add_client($clientid, $digest, $hostname, $mac, $ip, $profileid, $osid, $contact, $status, $installtime, $assetid) {
#clientid, assetid, digest, cert, hostname, mac, ip, gli_profile, osid, status, contact, installtime
if (!$installtime) {$installtime = "NOW()"; }
global $db;
- $result = $db->insert('clients', array('digest' => $digest, 'hostname' => $hostname, 'mac' => $mac, 'ip' => $ip, 'gli_profile' => $profileid, 'osid' => $osid, 'contact' => $contact, 'status' => $status, 'installtime' => $installtime, 'assetid' => $assetid));
+ $result = $db->insert('clients', array('clientid' => $clientid, 'digest' => $digest, 'hostname' => $hostname, 'mac' => $mac, 'ip' => $ip, 'gli_profile' => $profileid, 'osid' => $osid, 'contact' => $contact, 'status' => $status, 'installtime' => $installtime, 'assetid' => $assetid));
if ($result) {
return true;
} else {
@@ -130,9 +130,9 @@ function get_scire_user($userid) {
}
}
-function scire_add_user($username, $password, $real_name, $comment, $email, $phone, $pager) {
+function scire_add_user($userid, $username, $password, $real_name, $comment, $email, $phone, $pager) {
global $db;
- $result = $db->insert('users', array('username' => $username, 'password' => crypt($password, 447470567), 'comment' => $comment, 'real_name' => $real_name, 'email' => $email, 'phone' => $phone, 'pager' => $pager));
+ $result = $db->insert('users', array('userid' => $userid, 'username' => $username, 'password' => crypt($password, 447470567), 'comment' => $comment, 'real_name' => $real_name, 'email' => $email, 'phone' => $phone, 'pager' => $pager));
if ($result) {
return true;
} else {
@@ -160,9 +160,9 @@ function scire_del_user($userid) {
}
}
-function scire_add_permission($perm_name, $desc, $created_by) {
+function scire_add_permission($permid, $perm_name, $desc, $created_by) {
global $db;
- $result = $db->insert('permissions', array('name' => $perm_name, 'description' => $desc, 'creator' => $created_by));
+ $result = $db->insert('permissions', array('permid' => $permid, 'name' => $perm_name, 'description' => $desc, 'creator' => $created_by));
if ($result) {
return true;
} else {
diff --git a/scire/admin.php b/scire/admin.php
deleted file mode 100644
index af16029..0000000
--- a/scire/admin.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-include('.lib/common.php');
-$smarty->display('admin.tpl');
-?>
diff --git a/scire/assign_permission.php b/scire/assign_permission.php
index 9ccdcb6..06f0f62 100755
--- a/scire/assign_permission.php
+++ b/scire/assign_permission.php
@@ -17,8 +17,6 @@ $userid = "";
#Adding a permission.
if ($_POST['addperm_submit'] or $_POST['editperm_submit']) {
if ($_POST['newpermname'] and $_POST['newpermdesc']) { #Add a new permission FIXME add check of auth for this.
- $status = scire_add_permission($_POST['newpermname'],$_POST['newpermdesc'], $_SESSION['userid']);
- if ($status == 1) { $status = "Permission Addition successfull. "; }
if ($_POST['perm_category'] == "new") {
if ($_POST['newpermcat']) { #Need to add a section
$acl->add_object_section($_POST['newpermcat'], $_POST['newpermcat'], 1, 0, 'ACO');
@@ -30,6 +28,8 @@ if ($_POST['addperm_submit'] or $_POST['editperm_submit']) {
}
$obj_id = $acl->add_object($_POST['perm_category'], $_POST['newpermname'], $_POST['newpermname'], 1, 0, 'ACO');
$status .= "Obj id: $obj_id";
+ $result = scire_add_permission($obj_id, $_POST['newpermname'],$_POST['newpermdesc'], $_SESSION['userid']);
+ if ($result == 1) { $status .= "Permission Addition successfull. "; }
$_POST['perm'] = $_POST['newpermname'];
}
#Permission should exist now.
diff --git a/scire/client.php b/scire/client.php
index 17514b2..fe30fd7 100755
--- a/scire/client.php
+++ b/scire/client.php
@@ -36,10 +36,11 @@ if ($_POST['addgroup_confirm']) {
# Adding a client.
if ($_POST['addhostname']) {
if ($_POST['addhostname'] and $_POST['ip'] and $_POST['mac']) {
- $status = scire_add_client($_POST['digest'], $_POST['addhostname'], $_POST['mac'], $_POST['ip'], $_POST['gli_profile'], $_POST['osid'], $_POST['contact'], $_POST['status'], $_POST['installtime'], $_POST['assetid']);
- if ($status == 1) { $status = "Client Addition successfull"; }
$obj_id = $acl->add_object("clients", $_POST['addhostname'], $_POST['addhostname'], 1, 0, 'AXO');
- #print "Object id: $obj_id <BR>";
+ $status = "Object id: $obj_id <BR>";
+ $result = scire_add_client($obj_id, $_POST['digest'], $_POST['addhostname'], $_POST['mac'], $_POST['ip'], $_POST['gli_profile'], $_POST['osid'], $_POST['contact'], $_POST['status'], $_POST['installtime'], $_POST['assetid']);
+ if ($result == 1) { $status .= "Client Addition successfull"; }
+
if ($_POST['groups']) {
#print "Adding client to groups ".$_POST['groups'];
foreach( $_POST['groups'] as $group) {
diff --git a/scire/ui_permissions.php b/scire/ui_permissions.php
index 9cc0342..79fd00f 100755
--- a/scire/ui_permissions.php
+++ b/scire/ui_permissions.php
@@ -16,10 +16,11 @@ $userid = "";
#Adding a permission.
if ($_POST['addperm_submit'] or $_POST['editperm_submit']) {
if ($_POST['newpermname'] and $_POST['newpermdesc']) { #Add a new permission FIXME add check of auth for this.
- $status = scire_add_permission($_POST['newpermname'],$_POST['newpermdesc'], $_SESSION['userid']);
- if ($status == 1) { $status = "Permission Addition successfull. "; }
$obj_id = $acl->add_object($scire_ui_section, $_POST['newpermname'], $_POST['newpermname'], 1, 0, 'ACO');
$status .= "Obj id: $obj_id";
+ $result = scire_add_permission($obj_id, $_POST['newpermname'],$_POST['newpermdesc'], $_SESSION['userid']);
+ if ($result == 1) { $status .= "Permission Addition successfull. "; }
+
$_POST['perm'] = $_POST['newpermname'];
}
#Permission should exist now.
diff --git a/scire/user.php b/scire/user.php
index a43742a..d707ce2 100755
--- a/scire/user.php
+++ b/scire/user.php
@@ -37,10 +37,10 @@ if ($_POST['addgroup_confirm']) {
if ($_POST['addusername']) {
if ($_POST['passwd'] == $_POST['passwd2']) {
if ($_POST['addusername'] and $_POST['passwd'] and $_POST['email']) {
- $status = scire_add_user($_POST['addusername'], $_POST['passwd'], $_POST['real_name'], $_POST['comment'], $_POST['email'], $_POST['phone'], $_POST['pager']);
- if ($status == 1) { $status = "User Addition successfull"; }
$obj_id = $acl->add_object("users", $_POST['addusername'], $_POST['addusername'], 1, 0, 'ARO');
- #print "Object id: $obj_id <BR>";
+ $status = "Object id: $obj_id <BR>";
+ $status = scire_add_user($obj_id, $_POST['addusername'], $_POST['passwd'], $_POST['real_name'], $_POST['comment'], $_POST['email'], $_POST['phone'], $_POST['pager']);
+ if ($status == 1) { $status .= "User Addition successfull"; }
if ($_POST['groups']) {
#print "Adding user to groups ".$_POST['groups'];
foreach( $_POST['groups'] as $group) {