provide a few system defined permcats; will require a permission editor page to define new (personal) ones.
This commit is contained in:
		| @@ -793,6 +793,15 @@ class Connedit extends \Zotlabs\Web\Controller { | |||||||
| 				$perms[] = array('perms_' . $k, $v, ((array_key_exists($k,$their_perms)) ? intval($their_perms[$k]) : ''),$thisperm, 1, (($checkinherited & PERMS_SPECIFIC) ? '' : '1'), '', $checkinherited); | 				$perms[] = array('perms_' . $k, $v, ((array_key_exists($k,$their_perms)) ? intval($their_perms[$k]) : ''),$thisperm, 1, (($checkinherited & PERMS_SPECIFIC) ? '' : '1'), '', $checkinherited); | ||||||
| 			} | 			} | ||||||
| 	 | 	 | ||||||
|  | 			$pcat = new \Zotlabs\Lib\Permcat(local_channel()); | ||||||
|  | 			$pcatlist = $pcat->listing(); | ||||||
|  | 			$permcats = []; | ||||||
|  | 			if($pcatlist) { | ||||||
|  | 				foreach($pcatlist as $pc) { | ||||||
|  | 					$permcats[$pc['name']] = $pc['localname']; | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  |  | ||||||
| 			$locstr = ''; | 			$locstr = ''; | ||||||
| 	 | 	 | ||||||
| 			$locs = q("select hubloc_addr as location from hubloc left join site on hubloc_url = site_url where hubloc_hash = '%s' | 			$locs = q("select hubloc_addr as location from hubloc left join site on hubloc_url = site_url where hubloc_hash = '%s' | ||||||
| @@ -817,6 +826,7 @@ class Connedit extends \Zotlabs\Web\Controller { | |||||||
| 			$o .= replace_macros($tpl, [ | 			$o .= replace_macros($tpl, [ | ||||||
| 				'$header'         => (($self) ? t('Connection Default Permissions') : sprintf( t('Connection: %s'),$contact['xchan_name'])), | 				'$header'         => (($self) ? t('Connection Default Permissions') : sprintf( t('Connection: %s'),$contact['xchan_name'])), | ||||||
| 				'$autoperms'      => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), t('Connection requests will be approved without your interaction'), $yes_no), | 				'$autoperms'      => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), t('Connection requests will be approved without your interaction'), $yes_no), | ||||||
|  | 				'$permcat'        => [ 'permcat', t('Permission role'), '', '',$permcats ], | ||||||
| 				'$addr'           => $contact['xchan_addr'], | 				'$addr'           => $contact['xchan_addr'], | ||||||
| 				'$section'        => $section, | 				'$section'        => $section, | ||||||
| 				'$sections'       => $sections, | 				'$sections'       => $sections, | ||||||
|   | |||||||
| @@ -17,6 +17,15 @@ $(document).ready(function() { | |||||||
| 			connectFullShare(); | 			connectFullShare(); | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 	$('#id_permcat').change(function() { | ||||||
|  | 		$('.loading-role-rotator').spin(true); | ||||||
|  | 		var permName = $('#id_permcat').val(); | ||||||
|  | 		loadAbookRole(permName); | ||||||
|  | 	}); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	$(document).on('click', '.vcard-header, .vcard-cancel-btn', updateView); | 	$(document).on('click', '.vcard-header, .vcard-cancel-btn', updateView); | ||||||
| 	$(document).on('click', '.add-field', doAdd); | 	$(document).on('click', '.add-field', doAdd); | ||||||
| 	$(document).on('click', '.remove-field', doRemove); | 	$(document).on('click', '.remove-field', doRemove); | ||||||
| @@ -119,6 +128,7 @@ function loadAbookRole(name) { | |||||||
| 			if(this.value) | 			if(this.value) | ||||||
| 				$('#me_id_perms_' + this.name).attr('checked','checked'); | 				$('#me_id_perms_' + this.name).attr('checked','checked'); | ||||||
| 		}); | 		}); | ||||||
|  | 		$('.loading-role-rotator').spin(false); | ||||||
| 	}); | 	}); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -473,6 +473,9 @@ | |||||||
| 						{{if $self}}{{$permnote_self}}{{/if}} | 						{{if $self}}{{$permnote_self}}{{/if}} | ||||||
| 						</div> | 						</div> | ||||||
|  |  | ||||||
|  | 						<div class="loading-role-rotator"></div> | ||||||
|  | 						{{include file="field_select.tpl" field=$permcat}} | ||||||
|  |  | ||||||
| 						<table id="perms-tool-table" class=form-group> | 						<table id="perms-tool-table" class=form-group> | ||||||
| 							<tr> | 							<tr> | ||||||
| 								<td></td> | 								<td></td> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user