guest access app
This commit is contained in:
parent
a7948d7bfe
commit
e3c04b1fd0
@ -14,8 +14,7 @@ class Permcats extends Controller {
|
||||
return;
|
||||
|
||||
if(! Apps::system_app_installed(local_channel(), 'Permission Categories'))
|
||||
return
|
||||
|
||||
return;
|
||||
|
||||
$channel = App::get_channel();
|
||||
|
||||
@ -67,7 +66,6 @@ class Permcats extends Controller {
|
||||
|
||||
$channel = App::get_channel();
|
||||
|
||||
|
||||
if(argc() > 1)
|
||||
$name = hex2bin(argv(1));
|
||||
|
||||
|
@ -1,16 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Zotlabs\Module\Settings;
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
use App;
|
||||
use Zotlabs\Web\Controller;
|
||||
use Zotlabs\Lib\Apps;
|
||||
|
||||
|
||||
class Tokens {
|
||||
class Tokens extends Controller {
|
||||
|
||||
function post() {
|
||||
|
||||
$channel = \App::get_channel();
|
||||
if(! local_channel())
|
||||
return;
|
||||
|
||||
check_form_security_token_redirectOnErr('/settings/tokens', 'settings_tokens');
|
||||
if(! Apps::system_app_installed(local_channel(), 'Guest Access'))
|
||||
return;
|
||||
|
||||
$channel = App::get_channel();
|
||||
|
||||
check_form_security_token_redirectOnErr('tokens', 'tokens');
|
||||
$token_errs = 0;
|
||||
if(array_key_exists('token',$_POST)) {
|
||||
$atoken_id = (($_POST['atoken_id']) ? intval($_POST['atoken_id']) : 0);
|
||||
@ -81,7 +89,19 @@ class Tokens {
|
||||
|
||||
function get() {
|
||||
|
||||
$channel = \App::get_channel();
|
||||
if(! local_channel())
|
||||
return;
|
||||
|
||||
if(! Apps::system_app_installed(local_channel(), 'Guest Access')) {
|
||||
//Do not display any associated widgets at this point
|
||||
App::$pdl = '';
|
||||
|
||||
$o = '<b>Guest Access App (Not Installed):</b><br>';
|
||||
$o .= t('Create access tokens so that non-members can access private content');
|
||||
return $o;
|
||||
}
|
||||
|
||||
$channel = App::get_channel();
|
||||
|
||||
$atoken = null;
|
||||
$atoken_xchan = '';
|
||||
@ -144,9 +164,9 @@ class Tokens {
|
||||
|
||||
|
||||
|
||||
$tpl = get_markup_template("settings_tokens.tpl");
|
||||
$tpl = get_markup_template("tokens.tpl");
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$form_security_token' => get_form_security_token("settings_tokens"),
|
||||
'$form_security_token' => get_form_security_token("tokens"),
|
||||
'$title' => t('Guest Access Tokens'),
|
||||
'$desc' => $desc,
|
||||
'$desc2' => $desc2,
|
@ -79,14 +79,6 @@ class Settings_menu {
|
||||
'selected' => ''
|
||||
);
|
||||
|
||||
if(feature_enabled(local_channel(),'access_tokens')) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Guest Access Tokens'),
|
||||
'url' => z_root() . '/settings/tokens',
|
||||
'selected' => ((argv(1) === 'tokens') ? 'active' : ''),
|
||||
);
|
||||
}
|
||||
|
||||
if($role === false || $role === 'custom') {
|
||||
$tabs[] = array(
|
||||
'label' => t('Connection Default Permissions'),
|
||||
|
6
app/tokens.apd
Normal file
6
app/tokens.apd
Normal file
@ -0,0 +1,6 @@
|
||||
version: 1
|
||||
url: $baseurl/tokens
|
||||
requires: local_channel
|
||||
name: Guest Access
|
||||
photo: icon:user-secret
|
||||
categories: Access Control
|
@ -71,21 +71,6 @@ function get_features($filtered = true, $level = (-1)) {
|
||||
|
||||
$arr = [
|
||||
|
||||
'access_control' => [
|
||||
t('Access Control and Permissions'),
|
||||
|
||||
[
|
||||
'access_tokens',
|
||||
t('Access Tokens'),
|
||||
t('Create access tokens so that non-members can access private content.'),
|
||||
false,
|
||||
get_config('feature_lock','access_tokens'),
|
||||
feature_level('access_tokens',2),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
|
||||
// Item tools
|
||||
'tools' => [
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
{{$desc}}
|
||||
</div>
|
||||
|
||||
<form action="settings/tokens" id="settings-account-form" method="post" autocomplete="off" >
|
||||
<form action="tokens" id="settings-account-form" method="post" autocomplete="off" >
|
||||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
||||
{{if $atoken}}<input type="hidden" name="atoken_id" value="{{$atoken.atoken_id}}" />{{/if}}
|
||||
{{include file="field_input.tpl" field=$name}}
|
||||
@ -61,8 +61,8 @@
|
||||
<table id="atoken-index">
|
||||
{{foreach $tokens as $t}}
|
||||
<tr id="atoken-index-{{$t.atoken_id}}" class="atoken-index-row">
|
||||
<td width="99%"><a href="settings/tokens/{{$t.atoken_id}}">{{$t.atoken_name}}</a></td>
|
||||
<td width="1%" class="atoken-index-tool"><i class="fa fa-trash-o drop-icons" onClick="dropItem('/settings/tokens/{{$t.atoken_id}}/drop', '#atoken-index-{{$t.atoken_id}}')"></i></td>
|
||||
<td width="99%"><a href="tokens/{{$t.atoken_id}}">{{$t.atoken_name}}</a></td>
|
||||
<td width="1%" class="atoken-index-tool"><i class="fa fa-trash-o drop-icons" onClick="dropItem('tokens/{{$t.atoken_id}}/drop', '#atoken-index-{{$t.atoken_id}}')"></i></td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</table>
|
Reference in New Issue
Block a user