aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-02-07 16:08:27 -0800
committerzotlabs <mike@macgirvin.com>2017-02-07 16:08:27 -0800
commitb2bae867d02b62708e09e5abf0ebd03a4d2b095e (patch)
tree10e0c03f1a054ffd262c70a8860474a9b6977b0f
parent1cef3f15d5174636b59c86bb816a0009940201ef (diff)
downloadvolse-hubzilla-b2bae867d02b62708e09e5abf0ebd03a4d2b095e.tar.gz
volse-hubzilla-b2bae867d02b62708e09e5abf0ebd03a4d2b095e.tar.bz2
volse-hubzilla-b2bae867d02b62708e09e5abf0ebd03a4d2b095e.zip
more background work for permcat support
-rw-r--r--Zotlabs/Access/PermissionRoles.php10
-rw-r--r--Zotlabs/Access/Permissions.php12
-rw-r--r--Zotlabs/Module/Permcat.php61
-rw-r--r--vendor/composer/autoload_classmap.php2
-rw-r--r--view/js/mod_connedit.js23
5 files changed, 100 insertions, 8 deletions
diff --git a/Zotlabs/Access/PermissionRoles.php b/Zotlabs/Access/PermissionRoles.php
index d7e162197..dd9a49d05 100644
--- a/Zotlabs/Access/PermissionRoles.php
+++ b/Zotlabs/Access/PermissionRoles.php
@@ -281,22 +281,22 @@ class PermissionRoles {
$permcats = [
[ 'follower', t('follower','permcat'),
- [ 'view_stream','view_profile','view_contacts','view_storage','view_pages',
+ [ 'view_stream','view_profile','view_contacts','view_storage','view_pages','view_wiki',
'post_like' ]
],
[ 'contributor', t('contributor','permcat'),
- [ 'view_stream','view_profile','view_contacts','view_storage','view_pages',
- 'post_wall','post_comments','post_like','tag_deliver','chat' ]
+ [ 'view_stream','view_profile','view_contacts','view_storage','view_pages','view_wiki',
+ 'post_wall','post_comments','write_wiki','post_like','tag_deliver','chat' ]
],
[ 'trusted', t('trusted','permcat'),
[ 'view_stream','view_profile','view_contacts','view_storage','view_pages',
- 'write_storage','post_wall','post_comments','post_like','tag_deliver',
+ 'write_storage','post_wall','write_pages','write_wiki','post_comments','post_like','tag_deliver',
'chat', 'republish' ]
],
[ 'moderator', t('moderator','permcat'),
[ 'view_stream','view_profile','view_contacts','view_storage','view_pages',
- 'write_storage','post_wall','post_comments','post_like','tag_deliver',
+ 'write_storage','post_wall','wite_pages','write_wiki','post_comments','post_like','tag_deliver',
'chat', 'republish' ]
]
];
diff --git a/Zotlabs/Access/Permissions.php b/Zotlabs/Access/Permissions.php
index 81408f122..b4b2e4d44 100644
--- a/Zotlabs/Access/Permissions.php
+++ b/Zotlabs/Access/Permissions.php
@@ -106,6 +106,18 @@ class Permissions {
}
+ static public function OPerms($arr) {
+ $ret = [];
+ if($arr) {
+ foreach($arr as $k => $v) {
+ $ret[] = [ 'name' => $k, 'value' => $v ];
+ }
+ }
+ return $ret;
+ }
+
+
+
static public function FilledAutoperms($channel_id) {
if(! intval(get_pconfig($channel_id,'system','autoperms')))
return false;
diff --git a/Zotlabs/Module/Permcat.php b/Zotlabs/Module/Permcat.php
new file mode 100644
index 000000000..e118f8aee
--- /dev/null
+++ b/Zotlabs/Module/Permcat.php
@@ -0,0 +1,61 @@
+<?php
+
+namespace Zotlabs\Module;
+
+use \Zotlabs\Access as Zaccess;
+
+class Permcat extends \Zotlabs\Web\Controller {
+
+ private $permcats = [];
+
+ public function init() {
+ if(! local_channel())
+ return;
+
+ $name = 'default';
+ $localname = t('default','permcat');
+
+ $perms = Zaccess\Permissions::FilledAutoPerms(local_channel());
+ if(! $perms) {
+ $role = get_pconfig(local_channel(),'system','permissions_role');
+ if($role) {
+ $x = Zaccess\PermissionRoles::role_perms($role);
+ $perms = Zaccess\Permissions::FilledPerms($x['perms_connect']);
+ }
+ if(! $perms) {
+ $perms = Zaccess\Permissions::FilledPerms([]);
+ }
+ }
+
+ $this->permcats[] = [
+ 'name' => $name,
+ 'localname' => $localname,
+ 'perms' => Zaccess\Permissions::Operms($perms)
+ ];
+
+
+ $p = Zaccess\PermissionRoles::permcats(local_channel());
+ if($p) {
+ for($x = 0; $x < count($p); $x++) {
+ $this->permcats[] = [
+ 'name' => $p[$x][0],
+ 'localname' => $p[$x][1],
+ 'perms' => Zaccess\Permissions::Operms(Zaccess\Permissions::FilledPerms($p[$x][2]))
+ ];
+ }
+ }
+
+ if(argc() > 1 && $this->permcats) {
+ foreach($this->permcats as $permcat) {
+ if(strcasecmp($permcat['name'],argv(1)) === 0) {
+ json_return_and_die($permcat);
+ }
+ }
+ json_return_and_die(['error' => true]);
+ }
+
+ json_return_and_die($this->permcats);
+
+ }
+
+} \ No newline at end of file
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
index ad3291349..54b09f68b 100644
--- a/vendor/composer/autoload_classmap.php
+++ b/vendor/composer/autoload_classmap.php
@@ -450,7 +450,6 @@ return array(
'Zotlabs\\Module\\Events' => $baseDir . '/Zotlabs/Module/Events.php',
'Zotlabs\\Module\\Fbrowser' => $baseDir . '/Zotlabs/Module/Fbrowser.php',
'Zotlabs\\Module\\Feed' => $baseDir . '/Zotlabs/Module/Feed.php',
- 'Zotlabs\\Module\\Ffsapi' => $baseDir . '/Zotlabs/Module/Ffsapi.php',
'Zotlabs\\Module\\Fhublocs' => $baseDir . '/Zotlabs/Module/Fhublocs.php',
'Zotlabs\\Module\\File_upload' => $baseDir . '/Zotlabs/Module/File_upload.php',
'Zotlabs\\Module\\Filer' => $baseDir . '/Zotlabs/Module/Filer.php',
@@ -494,7 +493,6 @@ return array(
'Zotlabs\\Module\\Oep' => $baseDir . '/Zotlabs/Module/Oep.php',
'Zotlabs\\Module\\Oexchange' => $baseDir . '/Zotlabs/Module/Oexchange.php',
'Zotlabs\\Module\\Online' => $baseDir . '/Zotlabs/Module/Online.php',
- 'Zotlabs\\Module\\Opensearch' => $baseDir . '/Zotlabs/Module/Opensearch.php',
'Zotlabs\\Module\\Page' => $baseDir . '/Zotlabs/Module/Page.php',
'Zotlabs\\Module\\Pconfig' => $baseDir . '/Zotlabs/Module/Pconfig.php',
'Zotlabs\\Module\\Pdledit' => $baseDir . '/Zotlabs/Module/Pdledit.php',
diff --git a/view/js/mod_connedit.js b/view/js/mod_connedit.js
index 252ed9e7c..d750f3a2f 100644
--- a/view/js/mod_connedit.js
+++ b/view/js/mod_connedit.js
@@ -1,6 +1,7 @@
$(document).ready(function() {
- $('form').areYouSure({'addRemoveFieldsMarksDirty':true, 'message': aStr['leavethispage'] }); // Warn user about unsaved settings
+ // Warn member about unsaved settings
+ $('form').areYouSure({'addRemoveFieldsMarksDirty':true, 'message': aStr['leavethispage'] });
if(typeof(after_following) !== 'undefined' && after_following) {
if(typeof(connectDefaultShare) !== 'undefined')
@@ -102,3 +103,23 @@ function connectFullShare() {
$('#me_id_perms_republish').attr('checked','checked');
$('#me_id_perms_post_like').attr('checked','checked');
}
+
+function loadAbookRole(name) {
+
+ if(! name)
+ name = 'default';
+
+ $('.abook-edit-me').each(function() {
+ if(! $(this).is(':disabled'))
+ $(this).removeAttr('checked');
+ });
+
+ $.get('permcat/' + name, function(data) {
+ $(data.perms).each(function() {
+ if(this.value)
+ $('#me_id_perms_' + this.name).attr('checked','checked');
+ });
+ });
+}
+
+