Esempio n. 1
0
 public function addSharedGroup(Group $group)
 {
     $bean = $this->bean();
     if ($bean === null) {
         return $this;
     }
     $bean->sharedGroupList[] = $group->bean();
     return $this;
 }
Esempio n. 2
0
use Enpowi\Users\Group;
use Enpowi\Modules\DataOut;
use Enpowi\Modules\Module;
Module::is();
$app = App::get();
$auth = $app->authentication;
$page = App::paramIs('page') ? App::paramInt('page') : 1;
$users = null;
if (App::paramIs('email')) {
    $users = [User::getByEmail(App::param('email'))];
    $pages = 0;
} else {
    $users = User::users($page);
    $pages = User::pages();
}
(new DataOut())->add('email', App::param('email'))->add('pages', $pages)->add('page', $page)->add('users', $users)->add('availableGroups', Group::groups())->add('impersonateUser', $auth->isImpersonate() ? $auth->getUser() : [])->add('action', '')->bind();
?>
<form
	v-module
	action="users/listService"
	v-bind:data-done="page ? 'users/list?page=' + page : 'users/list'"
	class="container">
	<h3><span v-t>Users</span>
		<a v-title="New User" href="#/users/new"><span class="glyphicon glyphicon-plus-sign"></span></a></h3>
	<input
		name="q"
		v-placeholder="find user"
		v-find="{
			find: 'users/listService?action=find&q=',
			url: 'users/list?email='
		}"
Esempio n. 3
0
<?php

use Enpowi\App;
use Enpowi\Users\User;
use Enpowi\Users\Group;
use Enpowi\Modules\DataOut;
use Enpowi\Modules\Module;
Module::is();
$app = App::get();
$auth = $app->authentication;
$data = (new DataOut())->add('users', User::users())->add('availableGroups', Group::groups())->add('impersonateUser', $auth->isImpersonate() ? $auth->getUser() : [])->add('action', '')->out();
?>
<form
	v-module
    data="<?php 
echo $data;
?>
"
	action="users/listService"
	data-done="users/list"
	class="container">
	<h3><span v-t>Users</span>
		<a v-title="New User" href="#/users/new"><span class="glyphicon glyphicon-plus-sign"></span></a></h3>
	<table class="table">
		<tbody>
			<tr>
				<td></td>
				<th v-t>Email</th>
				<th v-t>Created</th>
				<td>
					<span v-show="impersonateUser.email">
Esempio n. 4
0
<?php

use Enpowi\Modules\DataOut;
use Enpowi\Users\Group;
use Enpowi\Modules\Module;
Module::is();
$data = (new DataOut())->add('moduleMap', Module::map())->add('anonymousGroup', (new Group('Anonymous'))->updatePerms())->add('registeredGroup', (new Group('Registered'))->updatePerms())->add('editableGroups', Group::editableGroups(true, true))->out();
?>
<form
	v-module
    data="<?php 
echo $data;
?>
"
	action="perms/listService"
	listen
	class="container">

	<table class="table">
		<thead>
			<tr>
				<th v-t colspan="2" class="center">Permission</th>
				<th v-t colspan="{{ editableGroups.length + 2 }}" class="center">Groups</th>
			</tr>
			<tr>
				<th v-t>Module</th>
				<th v-t>Component</th>
				<th class="center">
					{{ anonymousGroup.name }}
					<input type="hidden" name="groupNames[]" value="{{ anonymousGroup.name }}">
				</th>
Esempio n. 5
0
<?php

use Enpowi\Users\Group;
use Enpowi\Modules\DataOut;
use Enpowi\Modules\Module;
Module::is();
$data = (new DataOut())->add('groups', Group::groups())->out();
?>
<form
	v-module
    data="<?php 
echo $data;
?>
"
	action="group/listService"
	data-done="group/list"
	class="container">
	<h3><span v-t>Groups</span> <a v-title="New Group" href="#group/new"><span class="glyphicon glyphicon-plus-sign"></span></a></h3>
	<table class="table">
		<tr>
			<th v-t>Group Name</th>
		</tr>
		<tr v-repeat="group : groups">
			<td class="checkbox" colspan="2">
				<label>
					<input
						type="checkbox"
						name="groupNames[]"
						value="{{ group.name }}"
						disabled="{{ group.isSystem }}">
					{{group.name}}
Esempio n. 6
0
<?php

use Enpowi\Users\Group;
use Enpowi\Modules\DataOut;
use Enpowi\Modules\Module;
Module::is();
(new DataOut())->add('groups', Group::groups())->bind();
?>
<form
	v-module
	action="group/listService"
	data-done="group/list"
	class="container">
	<h3><span v-t>Groups</span> <a v-title="New Group" href="#group/new"><span class="glyphicon glyphicon-plus-sign"></span></a></h3>
	<table class="table">
		<tr>
			<th v-t>Group Name</th>
		</tr>
		<tr v-for="group in groups">
			<td class="checkbox" colspan="2">
				<label>
					<input
						type="checkbox"
						name="groupNames[]"
						value="{{ group.name }}"
						disabled="{{ group.isSystem }}">
					{{group.name}}
				</label>
			</td>
		</tr>
		<tr>
Esempio n. 7
0
    public static function editableGroups($updatePerms = false, $excludeSuper = false, $pageNumber = 1)
    {
        $beans = null;
        $groups = [];
        if ($excludeSuper) {
            $beans = R::find('group', '
				is_default_anonymous = 0
				and is_default_registered = 0
				and is_everyone = 0
				and is_super = 0
				order by name
				limit :offset, :count', ['offset' => App::pageOffset($pageNumber), 'count' => App::$pagingSize]);
        } else {
            $beans = R::find('group', '
				is_default_anonymous = 0
				and is_default_registered = 0
				and is_everyone = 0
				order by name
				limit :offset, :count', ['offset' => App::pageOffset($pageNumber), 'count' => App::$pagingSize]);
        }
        foreach ($beans as $groupBean) {
            $group = new Group($groupBean->name, $groupBean);
            $groups[] = $group;
            if ($updatePerms) {
                $group->updatePerms();
            }
        }
        return $groups;
    }
Esempio n. 8
0
require_once $dir . '/../../vendor/autoload.php';
require_once $dir . '/../setup/config.php';
use RedBeanPHP\R;
use Enpowi\Users\Group;
use Enpowi\Users\User;
use Enpowi\Users\Perm;
use Enpowi\App;
use Enpowi\Modules\Module;
Module::run();
R::nuke();
App::log('setup', 'newSite');
//create groups
$everyoneGroup = Group::create('Everyone', false, false, true);
$anonymousGroup = Group::create('Anonymous', false, true);
$registeredGroup = Group::create('Registered', true);
$administratorGroup = Group::create('Administrator', false, false, false, true);
//create first user & put him in admin group
$administratorUser = User::create('admin', 'admin', true);
$administratorGroup->addUser($administratorUser);
//give Anonymous abilities
Perm::create('user', 'login', $anonymousGroup);
Perm::create('user', 'register', $anonymousGroup);
Perm::create('user', 'forgot', $anonymousGroup);
Perm::create('user', 'confirm', $anonymousGroup);
//give registered abilities
Perm::create('gallery', '*', $registeredGroup);
Perm::create('user', 'view', $registeredGroup);
Perm::create('user', 'logout', $registeredGroup);
Perm::create('user', 'confirm', $registeredGroup);
Perm::create('page', 'edit', $registeredGroup);
//give Administrator group access to everything
Esempio n. 9
0
<?php

use Enpowi\App;
use Enpowi\Users\Group;
use Enpowi\Users\User;
use Enpowi\Modules\DataOut;
use Enpowi\Modules\Module;
Module::is();
$data = (new DataOut())->add('user', $user = new User(App::param('email')))->add('groups', Group::editableGroups())->out();
?>
<form
	listen
	v-module
    data="<?php 
echo $data;
?>
"
	action="group/ofUserService"
	class="container">

	<h3>
		<span v-t>Groups for: </span>
		{{ user.email }}
	</h3>

	<input
		name="user"
		type="hidden"
		value="{{ stringify( user ) }}">

	<div v-repeat=" group : groups ">
Esempio n. 10
0
<?php

use Enpowi\App;
use Enpowi\Users\Group;
use Enpowi\Modules\Module;
Module::is();
$groupName = App::param('groupName');
$reply = [];
$stop = false;
if (!Group::isValidGroupName($groupName)) {
    $reply['groupName'] = 'Invalid';
}
if ($stop) {
    echo json_encode(['paramResponse' => $reply, 'id' => -1]);
    die;
}
$id = Group::create($groupName);
echo json_encode(['id' => $id]);