From: Alan Knowles Date: Mon, 12 Apr 2010 09:35:44 +0000 (+0800) Subject: init X-Git-Url: http://git.roojs.org/?p=Pman.Admin;a=commitdiff_plain;h=1065f6e48bc88bd460bf43036cdb1768471f6583 init --- 1065f6e48bc88bd460bf43036cdb1768471f6583 diff --git a/Admin.perms.json b/Admin.perms.json new file mode 100644 index 0000000..23aecda --- /dev/null +++ b/Admin.perms.json @@ -0,0 +1,9 @@ + +{ + + + "Admin_Tab" : [ "S", "" ] , + "Logs" : [ "S", "" ] + +} + \ No newline at end of file diff --git a/Admin.translation.json b/Admin.translation.json new file mode 100644 index 0000000..9c1c2b0 --- /dev/null +++ b/Admin.translation.json @@ -0,0 +1,199 @@ + +"Pman.Tab.Teams.js" : { + "Teams" : "Teams", + "Staff Teams" : "Staff Teams" +}, +"Pman.Tab.Admin.js" : { + "Admin" : "Admin", + "Add Project" : "Add Project", + "Administration" : "Administration" +}, +"Pman.Tab.Groups.js" : { + "Groups" : "Groups", + "Permission Groups" : "Permission Groups" +}, +"Pman.Tab.Office.js" : { + "Add" : "Add", + "Fax" : "Fax", + "Edit" : "Edit", + "Email" : "Email", + "Error" : "Error", + "Phone" : "Phone", + "Delete" : "Delete", + "Address" : "Address", + "Select a Row" : "Select a Row", + "No Offices found" : "No Offices found", + "Select only one Row" : "Select only one Row", + "Name / Department / Sub Comp." : "Name / Department / Sub Comp.", + "Displaying Offices {0} - {1} of {2}" : "Displaying Offices {0} - {1} of {2}", + "Select a company to add a office to" : "Select a company to add a office to", + "Offices / Departments / Sub-Companies" : "Offices / Departments / Sub-Companies" +}, +"Pman.Tab.Contacts.js" : { + "Contact" : "Contact", + "Contacts" : "Contacts", + "Contacts List" : "Contacts List" +}, +"Pman.Tab.GroupMgr.js" : { + "Permissions" : "Permissions", + "Groups and Permissions" : "Groups and Permissions" +}, +"Pman.Tab.StaffMgr.js" : { + "Staff / Teams" : "Staff / Teams", + "Staff Manager" : "Staff Manager" +}, +"Pman.Dialog.Groups.js" : { + "" : "", + "Save" : "Save", + "Cancel" : "Cancel", + "Leader" : "Leader", + "Edit Team" : "Edit Team", + "Edit Group" : "Edit Group", + "Group Name" : "Group Name", + "Searching..." : "Searching...", + "Enter Group name" : "Enter Group name", + "Select Person Who opened" : "Select Person Who opened" +}, +"Pman.Tab.AdminLogs.js" : { + "Logs" : "Logs" +}, +"Pman.Tab.Companies.js" : { + "Add" : "Add", + "Fax" : "Fax", + "Tel" : "Tel", + "Edit" : "Edit", + "Name" : "Name", + "Ref#" : "Ref#", + "Type" : "Type", + "Email" : "Email", + "Error" : "Error", + "Delete" : "Delete", + "Address" : "Address", + "Offices" : "Offices", + "Remarks" : "Remarks", + "Companies" : "Companies", + "Select a Row" : "Select a Row", + "No Companies found" : "No Companies found", + "Select only one Row" : "Select only one Row", + "Contact Companies Manager" : "Contact Companies Manager", + "Displaying Companies {0} - {1} of {2}" : "Displaying Companies {0} - {1} of {2}" +}, +"Pman.Tab.ProjectMgr.js" : { + "" : "", + "Add" : "Add", + "All" : "All", + "Code" : "Code", + "Edit" : "Edit", + "Team" : "Team", + "Type" : "Type", + "Error" : "Error", + "Client" : "Client", + "Closed" : "Closed", + "Search" : "Search", + "Project" : "Project", + "Remarks" : "Remarks", + "Projects" : "Projects", + "Add Project" : "Add Project", + "Non-Project" : "Non-Project", + "Non-Projects" : "Non-Projects", + "Project Name" : "Project Name", + "Reset Search" : "Reset Search", + "Select a Row" : "Select a Row", + "Project Manager" : "Project Manager", + "Project (Closed)" : "Project (Closed)", + "Select only one Row" : "Select only one Row", + "Non-Project (Closed)" : "Non-Project (Closed)", + "Project (Unconfirmed)" : "Project (Unconfirmed)" +}, +"Pman.Tab.PersonStaff.js" : { + "Staff" : "Staff" +}, +"Pman.Tab.ContactsMgr.js" : { + "Contacts Manager" : "Contacts Manager" +}, +"Pman.Tab.ContactGrps.js" : { + "Groups" : "Groups", + "Contacts Groups" : "Contacts Groups" +}, +"Pman.Tab.Group_Rights.js" : { + "" : "", + "Add" : "Add", + "Fax" : "Fax", + "Edit" : "Edit", + "Save" : "Save", + "Email" : "Email", + "Staff" : "Staff", + "[All]" : "[All]", + "Delete" : "Delete", + "Events" : "Events", + "Groups" : "Groups", + "Person" : "Person", + "Reload" : "Reload", + "Rights" : "Rights", + "Offices" : "Offices", + "Admin Tab" : "Admin Tab", + "Companies" : "Companies", + "Documents" : "Documents", + "List/View" : "List/View", + "Timesheet" : "Timesheet", + "Permission" : "Permission", + "Document Types" : "Document Types", + "Print / Export" : "Print / Export", + "Projects (All)" : "Projects (All)", + "Document Manager" : "Document Manager", + "Unread Documents" : "Unread Documents", + "Work In Progress" : "Work In Progress", + "Permission Groups" : "Permission Groups", + "Project Directory" : "Project Directory", + "Distribute Documents" : "Distribute Documents", + "Projects (Member Of)" : "Projects (Member Of)", + "Send Faxes To Companies" : "Send Faxes To Companies", + "There was a problem saving the data" : "There was a problem saving the data", + "You can not set permissions for that group" : "You can not set permissions for that group" +}, +"Pman.Tab.AdminProjects.js" : { + "Add" : "Add", + "All" : "All", + "Edit" : "Edit", + "Error" : "Error", + "Show:" : "Show:", + "Closed" : "Closed", + "Project" : "Project", + "Search:" : "Search:", + "Projects" : "Projects", + "Non-Project" : "Non-Project", + "Non-Projects" : "Non-Projects", + "Admin - Projects" : "Admin - Projects", + "Project (Closed)" : "Project (Closed)", + "Select a Project" : "Select a Project", + "No Projects found" : "No Projects found", + "Non-Project (Closed)" : "Non-Project (Closed)", + "Project (Unconfirmed)" : "Project (Unconfirmed)", + "Select only one Project" : "Select only one Project", + "Displaying Projects {0} - {1} of {2}" : "Displaying Projects {0} - {1} of {2}" +}, +"Pman.Tab.Group_Members.js" : { + "Staff Membership" : "Staff Membership", + "Permission Group Membership" : "Permission Group Membership" +}, +"Pman.Tab.AdminLogEvents.js" : { + "Show" : "Show", + "Events" : "Events", + "Person " : "Person ", + "Searching..." : "Searching...", + "Select Person " : "Select Person ", + "No Events found" : "No Events found", + "Admin - Logs - Events" : "Admin - Logs - Events", + "Displaying Events {0} - {1} of {2}" : "Displaying Events {0} - {1} of {2}" +}, +"Pman.Dialog.PersonBulkAdd.js" : { + "Bulk add Contacts" : "Bulk add Contacts" +}, +"Pman.Tab.AdminTranslations.js" : { + "Error" : "Error", + "Translations" : "Translations", + "Select Module" : "Select Module", + "Select Language" : "Select Language", + "Admin - Translations" : "Admin - Translations", + "There was a problem saving the data - try reloading" : "There was a problem saving the data - try reloading" +}, \ No newline at end of file diff --git a/GroupRights.php b/GroupRights.php new file mode 100644 index 0000000..eebc395 --- /dev/null +++ b/GroupRights.php @@ -0,0 +1,128 @@ +getAuthUser(); + if (!$au) { + $this->jerr("Not authenticated", array('authFailure' => true)); + } + $this->authUser = $au; + return true; + } + + // perms - any table that can be modified by the user should be listed here.. + // without it, our perms manager should deny writing via the web interface... + + // FOR PERMS - SEE THE DATAOBJECT! + + function get() + { + // must recieve a group.. + if (!isset($_GET['group_id']) || (int)$_GET['group_id'] < 0) { + $this->jerr("NO GROUP"); + } + if (!$this->hasPerm( 'Core.Groups','S')) { // listing groups.. + $this->jerr("PERMISSION DENIED"); + } + // DB_DataObject::debugLevel(1); + $p = DB_DataObject::factory('Group_Rights'); + $p->group_id = (int)$_GET['group_id']; + $p->find(); + $cur = array(); + + while ($p->fetch()) { + $cur[$p->rightname] = clone($p); + } + $e = -1; + $ar = array(); + // echo "
"; print_r($p->defaultPermData() );
+        foreach($p->defaultPermData() as $k => $defdata) {
+            
+            if (empty($defdata[0])) { // no admin data available..
+                continue;
+            }
+            if (!isset($cur[$k])) {
+                // then there is no current access right for it..
+                //DB_DataObject::debugLevel(1);
+                $gr = DB_DataObject::factory('Group_Rights');
+                $gr->group_id = (int)$_GET['group_id'];
+                $gr->rightname = $k;
+                $gr->AccessMask = $defdata[1]; // set to defaults..
+                $gr->insert();
+                $cur[$k] = clone($gr);
+            }
+            
+            
+            $ar[] = array(
+                'id' => $cur[$k]->id * 1, //
+                'rightname' => $k,
+                'descript' => isset($defdata[2]) ? $defdata[2] : '' ,
+                'AccessMask' => $cur[$k]->AccessMask,
+                'FullMask' => $defdata[0],
+                'group_id' => (int)$_GET['group_id']
+            );
+                
+        }
+        $this->jdata($ar);
+        
+         
+    }
+    
+    
+    // post.. 
+    function post()
+    {
+        if (!isset($_POST['group_id']) || (int)$_POST['group_id'] < 0) {
+            $this->jerr("NO GROUP");
+        }
+        if (!$this->hasPerm( 'Core.Groups','E')) { // editing groups..
+            $this->jerr("PERMISSION DENIED");
+        }
+        
+        
+            
+        
+        
+        // add or update..
+        if (!empty($_POST['dataUpdate'])) {
+            foreach($_POST['dataUpdate'] as $id => $ac) {
+                $p = DB_DataObject::factory('Group_Rights');
+                $p->group_id = (int)$_POST['group_id'];
+                if (!$p->get($id)) {
+                    continue; // errro cond.
+                }
+                $po = clone($p);
+                $p->AccessMask = $ac;
+                $p->validate(); // ensure that the basic perms can not be removed
+                $p->update($po);
+            }
+        }
+        if (!empty($_POST['dataAdd'])) {
+            foreach($_POST['dataAdd'] as $perm => $ac) {
+                $p = DB_DataObject::factory('Group_Rights');
+                $p->group_id = (int)$_POST['group_id'];
+                $p->rightname = $perm;
+                $p->AccessMask = $ac;
+                $p->validate(); // ensure that the basic perms can not be removed
+                $p->insert();
+            }
+        }
+        $this->jok("done");
+        
+        
+        
+    }
+     
+    
+    
+    
+    
+}
\ No newline at end of file
diff --git a/Pman.Dialog.Groups.js b/Pman.Dialog.Groups.js
new file mode 100644
index 0000000..0702ce5
--- /dev/null
+++ b/Pman.Dialog.Groups.js
@@ -0,0 +1,235 @@
+//