Index: gp-includes/routes/project.php
===================================================================
--- gp-includes/routes/project.php	(revision 528)
+++ gp-includes/routes/project.php	(working copy)
@@ -155,6 +155,22 @@
 		foreach( array_merge( (array)$permissions, (array)$parent_permissions ) as $permission ) {
 			$permission->user = GP::$user->get( $permission->user_id );
 		}
+
+		$is_admin = $this->can( 'admin', null, null );
+		$admins = GP::$permission->find_many( array( 'action' => 'write', 'object_type' => 'project', 'object_id' => $project->id ) );
+		$parent_admins = array();
+		foreach( $path_to_root as $parent_project ) {
+			$this_parent_admins = GP::$permission->find_many( array( 'action' => 'write', 'object_type' => 'project', 'object_id' => $parent_project->id ) );
+			foreach( $this_parent_admins as $admin ) {
+				$admin->project = $parent_project;
+			}
+			$parent_admins = array_merge( $parent_admins, (array)$this_parent_admins );
+		}
+		// we can't join on users table
+		foreach( array_merge( (array)$admins, (array)$parent_admins ) as $admin ) {
+			$admin->user = GP::$user->get( $admin->user_id );
+		}
+
 		$this->tmpl( 'project-permissions', get_defined_vars() );
 	}
 
@@ -180,6 +196,24 @@
 			$permission?
 				$this->notices[] = __('Validator was added.') : $this->errors[] = __('Error in adding validator.');
 		}
+		if ( 'add-admin' == gp_post( 'action' ) ) {
+			$this->can_or_redirect( 'admin', null, null );
+			$user = GP::$user->by_login( gp_post( 'user_login' ) );
+			if ( !$user ) {
+				$this->redirect_with_error( __('User wasn&#8217;t found!'), gp_url_current() );
+				return;
+			}
+			$new_permission = new GP_Permission( array(
+				'user_id' => $user->id,
+				'action' => 'write',
+				'object_id' => $project->id,
+				'object_type' => 'project'
+			) );
+			$this->validate_or_redirect( $new_permission, gp_url_current() );
+			$permission = GP::$permission->create( $new_permission );
+			$permission?
+				$this->notices[] = __('Administrator was added.') : $this->errors[] = __('Error in adding administrator.');
+		}
 		$this->redirect( gp_url_current() );
 	}
 	
Index: gp-templates/project-permissions-admin.php
===================================================================
--- gp-templates/project-permissions-admin.php	(revision 0)
+++ gp-templates/project-permissions-admin.php	(revision 0)
@@ -0,0 +1,52 @@
+<h3 id="admins">
+	<?php _e('Administrators'); ?>
+	<?php if ( count( $admins ) + count( $parent_admins ) > 10 ): ?>
+	<a href="#add" onclick="jQuery('#user_login_admin').focus(); return false;" class="secondary">Add &rarr;</a>
+	<?php endif; ?>
+</h3>
+	<?php if ( $admins ): ?>
+	<?php if ( $parent_admins ): ?>
+<h4 id="project-admins"><?php _e('Administrators for this project'); ?></h4>
+	<?php endif; ?>
+<ul class="permissions">
+	<?php foreach( $admins as $admin ): ?>
+		<li>
+			<span class="user"><?php echo esc_html( $admin->user->user_login ); ?></span>
+			<span class="permission-action"><?php printf( __( 'has full %s access' ), esc_html( $admin->action ) ); ?></span>
+<?php if ( $is_admin ): ?>
+			<a href="<?php echo gp_url_join( gp_url_current(), '-delete/'.$admin->id ); ?>" class="action delete"><?php _e('Remove'); ?></a>
+<?php endif; ?>
+		</li>
+	<?php endforeach; ?>
+</ul>	
+	<?php endif; ?>
+	<?php  if ( $parent_admins ): ?>
+<h4 id="parent-admins"><?php _e('Administrators for parent projects'); ?></h4>
+<ul class="permissions">
+		<?php foreach( $parent_admins as $admin ): ?>
+			<li>
+			<span class="user"><?php echo esc_html( $admin->user->user_login ); ?></span>
+			<span class="permission-action"><?php printf( __( 'has full %s access' ), esc_html( $admin->action ) ); ?></span>
+			<span class="permission-action"><?php _e( 'in the project' ); ?></span>
+			<span class="user"><?php gp_link_project( $admin->project, esc_html( $admin->project->name ) ); ?></span>
+			</li>
+		<?php endforeach; ?>
+</ul>				
+	<?php endif; ?>
+	<?php if ( !$admins && !$parent_admins ): ?>
+		<strong><?php _e('No administrators defined for this project.'); ?></strong>
+	<?php endif; ?>
+<?php if ( $is_admin ): ?>
+<form action="" method="post" class="secondary">
+	<h3 id="add-admin"><?php _e('Add an administrator for this project'); ?></h3>
+	<dl>
+		<dt><label for="user_login_admin"><?php _e('Username:'); ?></label></dt>
+		<dd><input type="text" name="user_login" value="" id="user_login_admin" /></dd>
+
+		<dt>
+			<input type="submit" name="submit" value="<?php echo esc_attr(__('Add &rarr;')); ?>" id="submit_admin" />
+			<input type="hidden" name="action" value="add-admin" />
+		</dt>
+	</dl>
+</form>
+<?php endif; ?>

Property changes on: gp-templates\project-permissions-admin.php
___________________________________________________________________
Added: svn:eol-style
   + native

Index: gp-templates/project-permissions.php
===================================================================
--- gp-templates/project-permissions.php	(revision 528)
+++ gp-templates/project-permissions.php	(working copy)
@@ -7,6 +7,7 @@
 gp_tmpl_header();
 ?>
 <h2><?php _e('Permissions'); ?></h2>
+<?php gp_tmpl_load( 'project-permissions-admin', get_defined_vars() ); ?>
 <h3 id="validators">
 	<?php _e('Validators'); ?>
 	<?php if ( count( $permissions ) + count( $parent_permissions ) > 10 ): ?>
@@ -28,7 +29,7 @@
 			<span class="user"><?php echo esc_html( $permission->set_slug ); ?></span>
 			<a href="<?php echo gp_url_join( gp_url_current(), '-delete/'.$permission->id ); ?>" class="action delete"><?php _e('Remove'); ?></a>
 		</li>
-	<? endforeach; ?>
+	<?php endforeach; ?>
 </ul>	
 	<?php endif; ?>
 	<?php  if ( $parent_permissions ): ?>
@@ -45,7 +46,7 @@
 				<span class="permission-action">in the project </span>
 				<span class="user"><?php gp_link_project( $permission->project, esc_html( $permission->project->name ) ); ?></span>
 			</li>
-		<? endforeach; ?>
+		<?php endforeach; ?>
 </ul>				
 	<?php endif; ?>
 	<?php if ( !$permissions && !$parent_permissions ): ?>

