Skip to Content.
Sympa Menu

comanage-dev - [comanage-dev] r644 - in registry/trunk/app: Config/Schema Controller Lib Model View View/ApiUsers View/Elements

Subject: COmanage Developers List

List archive

[comanage-dev] r644 - in registry/trunk/app: Config/Schema Controller Lib Model View View/ApiUsers View/Elements


Chronological Thread 
  • From:
  • To:
  • Subject: [comanage-dev] r644 - in registry/trunk/app: Config/Schema Controller Lib Model View View/ApiUsers View/Elements
  • Date: Sat, 14 Dec 2013 11:38:51 -0500

Author: benno
Date: 2013-12-14 11:38:51 -0500 (Sat, 14 Dec 2013)
New Revision: 644

Added:
registry/trunk/app/Controller/ApiUsersController.php
registry/trunk/app/View/ApiUsers/
registry/trunk/app/View/ApiUsers/add.ctp
registry/trunk/app/View/ApiUsers/edit.ctp
registry/trunk/app/View/ApiUsers/fields.inc
registry/trunk/app/View/ApiUsers/index.ctp
registry/trunk/app/View/ApiUsers/view.ctp
Modified:
registry/trunk/app/Config/Schema/schema.xml
registry/trunk/app/Lib/lang.php
registry/trunk/app/Model/ApiUser.php
registry/trunk/app/View/Elements/dropMenu.ctp
Log:
UI for CMP admin to manage API users

Modified: registry/trunk/app/Config/Schema/schema.xml
===================================================================
--- registry/trunk/app/Config/Schema/schema.xml 2013-12-13 01:53:12 UTC (rev
643)
+++ registry/trunk/app/Config/Schema/schema.xml 2013-12-14 16:38:51 UTC (rev
644)
@@ -418,7 +418,8 @@

<index name="api_users_i1">
<col>username</col>
- </index>
+ <unique />
+ </index>
</table>

<table name="co_groups">

Modified: registry/trunk/app/Lib/lang.php
===================================================================
--- registry/trunk/app/Lib/lang.php 2013-12-13 01:53:12 UTC (rev 643)
+++ registry/trunk/app/Lib/lang.php 2013-12-14 16:38:51 UTC (rev 644)
@@ -42,6 +42,10 @@
// What an Org is called
'org' => 'Organization',

+ // API User texts
+ 'ap.note.privs' => 'API Users are currently given full privileges to all
Registry data. This is subject to change in a future release (<a
href="https://bugs.internet2.edu/jira/browse/CO-91";>CO-91</a>).',
+ 'ap.note.username' => 'The API username selected here cannot conflict with
any identifier used by anyone to login to the platform',
+
// Authnz
'au.not' => 'Not Logged In',

@@ -55,6 +59,8 @@
// Titles, per-controller
'ct.addresses.1' => 'Address',
'ct.addresses.pl' => 'Addresses',
+ 'ct.api_users.1' => 'API User',
+ 'ct.api_users.pl' => 'API Users',
'ct.cmp_enrollment_configurations.1' => 'CMP Enrollment Configuration',
'ct.cmp_enrollment_configurations.pl' => 'CMP Enrollment Configurations',
'ct.co_enrollment_attributes.1' => 'CO Enrollment Attribute',
@@ -628,6 +634,7 @@
'fd.organization_id' => 'Organization ID',
'fd.ou' => 'Department',
'fd.parent' => 'Parent COU',
+ 'fd.password' => 'Password',
'fd.people' => '%1$s People',
'fd.perms' => 'Permissions',
'fd.petitioner' => 'Petitioner',
@@ -660,6 +667,7 @@
'fd.type.warn' => 'After an extended attribute is created, its type may
not be changed',
'fd.untitled' => 'Untitled',
'fd.url' => 'URL',
+ 'fd.username.api' => 'API User Name',
'fd.valid_from' => 'Valid From',
'fd.valid_from.desc' => '(leave blank for immediate validity)',
'fd.valid_through' => 'Valid Through',

Modified: registry/trunk/app/Model/ApiUser.php
===================================================================
--- registry/trunk/app/Model/ApiUser.php 2013-12-13 01:53:12 UTC (rev
643)
+++ registry/trunk/app/Model/ApiUser.php 2013-12-14 16:38:51 UTC (rev
644)
@@ -2,7 +2,7 @@
/**
* COmanage Registry ApiUser Model
*
- * Copyright (C) 2011-12 University Corporation for Advanced Internet
Development, Inc.
+ * Copyright (C) 2011-13 University Corporation for Advanced Internet
Development, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with
* the License. You may obtain a copy of the License at
@@ -14,25 +14,61 @@
* KIND, either express or implied. See the License for the specific
language governing
* permissions and limitations under the License.
*
- * @copyright Copyright (C) 2011-12 University Corporation for Advanced
Internet Development, Inc.
+ * @copyright Copyright (C) 2011-13 University Corporation for Advanced
Internet Development, Inc.
* @link http://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v0.2
* @license Apache License, Version 2.0
(http://www.apache.org/licenses/LICENSE-2.0)
* @version $Id$
*/
-
+
+App::uses('SimplePasswordHasher', 'Controller/Component/Auth');
+
class ApiUser extends AppModel {
// Define class name for cake
public $name = "ApiUser";

// Association rules from this model to other models
//public $hasOne = array("User"); // An API user has an associated
User
- // XXX not a formal model yet

// Default display field for cake generated views
public $displayField = "username";

// Default ordering for find operations
public $order = array("username");
+
+ public $actsAs = array('Containable');
+
+ // Validation rules for table elements
+ public $validate = array(
+ 'username' => array(
+ 'rule' => 'notEmpty',
+ 'required' => true,
+ 'allowEmpty' => false,
+ 'message' => 'A username must be provided'
+ ),
+ 'password' => array(
+ 'rule' => 'notEmpty',
+ 'required' => true,
+ 'allowEmpty' => false,
+ 'message' => 'A password must be provided'
+ )
+ );
+
+ /**
+ * Actions to take before a save operation is executed.
+ *
+ * @since COmanage Registry v0.9
+ */
+
+ public function beforeSave($options = array()) {
+ // Hash the password, per
http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html
+
+ if(isset($this->data[$this->alias]['password'])) {
+ $passwordHasher = new SimplePasswordHasher();
+ $this->data[$this->alias]['password'] =
$passwordHasher->hash($this->data[$this->alias]['password']);
+ }
+
+ return true;
+ }
}
\ No newline at end of file


Property changes on: registry/trunk/app/View/ApiUsers/add.ctp
___________________________________________________________________
Added: svn:special
+ *


Property changes on: registry/trunk/app/View/ApiUsers/edit.ctp
___________________________________________________________________
Added: svn:special
+ *


Property changes on: registry/trunk/app/View/ApiUsers/view.ctp
___________________________________________________________________
Added: svn:special
+ *

Modified: registry/trunk/app/View/Elements/dropMenu.ctp
===================================================================
--- registry/trunk/app/View/Elements/dropMenu.ctp 2013-12-13 01:53:12
UTC (rev 643)
+++ registry/trunk/app/View/Elements/dropMenu.ctp 2013-12-14 16:38:51
UTC (rev 644)
@@ -300,30 +300,30 @@
<?php
$args = array();
$args['plugin'] = null;
- $args['controller'] = 'cos';
+ $args['controller'] = 'api_users';
$args['action'] = 'index';

- print $this->Html->link(_txt('ct.cos.pl'), $args);
+ print $this->Html->link(_txt('ct.api_users.pl'), $args);
?>
</li>
<li>
<?php
$args = array();
$args['plugin'] = null;
- $args['controller'] = 'organizations';
- $args['action'] = 'index';
+ $args['controller'] = 'cmp_enrollment_configurations';
+ $args['action'] = 'select';

- print $this->Html->link(_txt('ct.organizations.pl'), $args);
+ print
$this->Html->link(_txt('ct.cmp_enrollment_configurations.pl'), $args);
?>
</li>
<li>
<?php
$args = array();
$args['plugin'] = null;
- $args['controller'] = 'cmp_enrollment_configurations';
- $args['action'] = 'select';
+ $args['controller'] = 'cos';
+ $args['action'] = 'index';

- print
$this->Html->link(_txt('ct.cmp_enrollment_configurations.pl'), $args);
+ print $this->Html->link(_txt('ct.cos.pl'), $args);
?>
</li>
<li>
@@ -336,6 +336,16 @@
print $this->Html->link(_txt('ct.navigation_links.pl'), $args);
?>
</li>
+ <li>
+ <?php
+ $args = array();
+ $args['plugin'] = null;
+ $args['controller'] = 'organizations';
+ $args['action'] = 'index';
+
+ print $this->Html->link(_txt('ct.organizations.pl'), $args);
+ ?>
+ </li>
<?php render_plugin_menus($this->Html, $plugins, 'cmp',
$menuCoId); ?>
</ul>
</li>



  • [comanage-dev] r644 - in registry/trunk/app: Config/Schema Controller Lib Model View View/ApiUsers View/Elements, svnlog, 12/14/2013

Archive powered by MHonArc 2.6.16.

Top of Page