本文整理汇总了PHP中Rights::member方法的典型用法代码示例。如果您正苦于以下问题:PHP Rights::member方法的具体用法?PHP Rights::member怎么用?PHP Rights::member使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rights
的用法示例。
在下文中一共展示了Rights::member方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_group
/**
* Update a group
* @return Group instance
*/
function update_group($name, $label, $ns, Userfilter $filter)
{
$gf = new GroupFilter(new GFC_Name($name));
$g = $gf->get(true);
if ($g instanceof Group) {
echo 'Updating ' . $label . ' (' . $name . ', ' . $g->id() . ') ';
$g->select(GroupSelect::castes());
} else {
echo 'Creating ' . $label . ' (' . $name . ') ';
$g = new Group();
$g->insert();
$g->ns($ns);
$g->name($name);
$g->label($label);
}
$c = $g->caste(Rights::member());
$c->select(CasteSelect::base());
$c->userfilter($filter);
$c->compute();
echo '... ' . $c->users()->count() . ' member(s)' . "\n";
return $g;
}
示例2: dirname
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
/*
* This script creates and updates the groups corresponding to the promos
*/
require_once dirname(__FILE__) . '/../connect.db.inc.php';
$gf = new GroupFilter(new GFC_Name('everybody'));
$g = $gf->get(true);
$g->select(GroupSelect::castes());
$c = $g->caste(Rights::member());
$c->select(CasteSelect::base())->compute();
echo 'Groupe everybody mis à jour' . "\n";
$gf = new GroupFilter(new GFC_Name('public'));
$g = $gf->get(true);
$g->select(GroupSelect::castes());
$c = $g->caste(Rights::member());
$c->select(CasteSelect::base())->compute();
echo 'Groupe visibilité extérieure mis à jour' . "\n";
$gf = new GroupFilter(new GFC_Name('licenses'));
$g = $gf->get(true);
$g->select(GroupSelect::castes());
$c = $g->caste(Rights::member());
$c->select(CasteSelect::base())->compute();
echo 'Groupe licenses mis à jour' . "\n";
示例3: dirname
<?php
/***************************************************************************
* Copyright (C) 2004-2012 Binet Réseau *
* http://br.binets.fr/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
require_once dirname(__FILE__) . '/../connect.db.inc.php';
$iter = XDB::iterRow('SELECT uid, pa FROM temp');
while (list($uid, $paname) = $iter->next()) {
$pa = Group::from($paname);
$u = new User($uid);
$pa->select(GroupSelect::castes());
$pa->caste(Rights::member())->addUser($u);
echo ".";
}
echo 'Over';
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
示例4: commit
public function commit()
{
$mem = $this->group->caste(Rights::member());
$fri = $this->group->caste(Rights::friend());
if ($mem->userfilter()) {
return false;
}
$mem->addUser($this->user);
$fri->removeUser($this->user);
return true;
}
示例5: __construct
public function __construct($us, $rights = null)
{
$this->uids = User::toIds(unflatten($us));
$this->rights = (string) (empty($rights) ? Rights::member() : $rights);
}
示例6: login
public static function login()
{
$cb = function ($users) {
$web = Group::from('webmasters');
foreach ($users as $u) {
if ($u->hasRights($web, Rights::member())) {
$u->perms()->addFlag('web');
}
}
};
return new UserSelect(array_merge(self::$natives, array('rooms', 'minimodules', 'castes', 'poly', 'comments', 'defaultfilters', 'studies', 'cuvisibility')), array('castes' => CasteSelect::group(), 'defaultfilters' => GroupSelect::base()), $cb);
}
示例7: dirname
* along with this program; if not, write to the Free Software *
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
/**
* This script checks groups and castes integrity
* Fixes are applied by CLI with php -a and include 'bin/connect.db.inc.php';
* For example, to fix caste userfilters, you may execute a line of PHP code like:
* $c = new Caste(12142); $c->userfilter('{"type":"user","condition":{"type":"caste","children":[12001,12002]}}');
* Use $c->userfilter(false) to remove a Userfilter
*/
require_once dirname(__FILE__) . '/../connect.db.inc.php';
//$available_rights = Rights::rights();
$available_rights = array('admin', 'logic', 'member', 'friend', 'restricted', 'everybody');
// Get webmaster caste
$ufc_web = new UFC_Group(Group::from('webmasters'), Rights::member());
// Get kes admins
$ufc_kes = new UFC_Group(Group::from('kes'), Rights::admin());
// Shalom-CCX-AMEP
$shccxamep_groups = new Collection();
$shccxamep_groups->add(Group::from('shalom'));
$shccxamep_groups->add(Group::from('ccx'));
$shccxamep_groups->add(Group::from('amep'));
$ufc_shalom_ccx_amep = new UFC_Group($shccxamep_groups, Rights::admin());
unset($shccxamep_groups);
// licenses members = on_platal and X
$ufc_licenses = new PFC_And(array(new UFC_Group(Group::from('formation_x'), Rights::restricted()), new UFC_Group(Group::from('on_platal'), Rights::restricted())));
// Get formations
$formations = array();
foreach (Formation::selectAll(FormationSelect::base()) as $form) {
$formations[$form->abbrev()] = intval($form->id());
示例8: insert
public function insert($id = null, $type = 'all')
{
if ($id == null) {
$this->name = uniqid();
XDB::execute('INSERT INTO groups SET name = {?}', $this->name);
$this->id = XDB::insertId();
} else {
$this->name = 'g_' . $id;
XDB::execute('INSERT INTO groups SET gid = {?}, name= {?}', $id, $this->name);
$this->id = $id;
}
/*
* Create the castes
*/
if ($type == 'user') {
// A user group only needs an admin caste & a restricted caste.
$this->addCaste(Rights::admin());
$this->addCaste(Rights::restricted());
} else {
$admins = $this->addCaste(Rights::admin());
$members = $this->addCaste(Rights::member());
$logics = $this->addCaste(Rights::logic());
$friends = $this->addCaste(Rights::friend());
/*
* Create the 'restricted' caste
*/
$restricted = new UserFilter(new UFC_Caste(array($admins, $members, $logics)));
$this->addCaste(Rights::restricted())->userfilter($restricted);
/*
* Create the 'everybody' caste
* It's better not to refer to the restricted caste, as we don't know in what
* order the bubbling is going to happen
*/
$everybody = new UserFilter(new UFC_Caste(array($admins, $members, $logics, $friends)));
$this->addCaste(Rights::everybody())->userfilter($everybody);
}
}
示例9: handler_tol_birthday
function handler_tol_birthday($page, $nice = 1)
{
$on_platal = Group::from('on_platal');
$next_week = new FrankizDateTime();
$week = new DateInterval('P7D');
$next_week = $next_week->add($week);
if ($nice) {
$order = array(new UFO_Promo(), new UFO_Birthday());
} else {
$order = new UFO_Birthday();
}
$uf = new UserFilter(new PFC_And(new UFC_Group($on_platal, Rights::member()), new UFC_Birthday('>=', new FrankizDateTime()), new UFC_Birthday('<=', $next_week)), $order);
$users = $uf->get()->select(UserSelect::tol());
$old_promo = 0;
header('Content-Type: text/html; charset=utf-8');
echo '<pre>';
foreach ($users as $u) {
$study = reset($u->studies());
$promo = $study->promo();
if ($nice && $old_promo != $promo) {
if ($old_promo != 0) {
echo "\n";
}
echo "Promotion " . $promo . "\n";
$old_promo = $promo;
}
if ($nice) {
echo $u->birthdate()->format('d/m/Y') . ' ' . $u->firstname() . ' ' . $u->lastname() . "\n";
} else {
echo $promo . ',' . $u->birthdate()->format('d/m/Y') . ',' . $u->lastname() . ',' . $u->firstname() . "\n";
}
}
echo '</pre>';
exit;
}
示例10: UserFilter
$temp->name('temp');
$temp->label('Temporary');
$temp->external(0);
$temp->leavable(0);
$temp->visible(0);
// Admins(temp) = Members(webmasters)
$temp->caste(Rights::admin())->userfilter(new UserFilter(new UFC_Group($webmasters, Rights::member())));
$g = new Group();
$g->insert();
$g->name('qdj');
$g->ns(Group::NS_FREE);
$g->label('Question Du Jour');
$g->external(0);
$g->leavable(0);
$g->visible(1);
// Admins(qdj) = Members(webmasters) the time of the conversion
$g->caste(Rights::admin())->userfilter(new UserFilter(new UFC_Group($webmasters, Rights::member())));
$g = new Group();
$g->insert();
$g->name('postit');
$g->label('Post-It');
// Admins(postit) = Members(webmasters) the time of the conversion
$g->caste(Rights::admin())->userfilter(new UserFilter(new UFC_Group($webmasters, Rights::member())));
$g = new Group();
$g->insert();
$g->name('licenses');
$g->label('Licenses');
// Admins(postit) = Members(webmasters) the time of the conversion
$g->caste(Rights::admin())->userfilter(new UserFilter(new UFC_Group($webmasters, Rights::member())));
echo "Added Fkz Microcosmos \n";
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
示例11: handler_group_subscribe
function handler_group_subscribe($page, $group, $right = 'friend')
{
S::assert_xsrf_token();
$group = Group::fromId($group);
if (!$group) {
$page->assign('title', "Ce groupe n'existe pas");
$page->changeTpl('groups/no_group.tpl');
return;
} elseif ($right == 'friend') {
$group->select(GroupSelect::subscribe());
$group->caste(Rights::friend())->addUser(S::user());
S::user()->select(UserSelect::castes());
pl_redirect('groups/see/' . $group->name());
exit;
} elseif ($right == 'member') {
$group->select(GroupSelect::subscribe());
if ($group->caste(Rights::member())->userfilter()) {
throw new Exception('You can\'t apply to this group');
}
$iv = new MemberValidate(S::user(), $group);
$v = new Validate(array('writer' => S::user(), 'group' => $group, 'item' => $iv, 'type' => 'member'));
$v->insert();
$page->assign('title', "Demande de statut de membre");
$page->changeTpl('groups/member.tpl');
}
}
示例12: handler_admin_account
public function handler_admin_account($page, $hruid = null, $added = false)
{
$err = array();
$msg = array();
$add = false;
if ($added) {
$msg[] = "L'utilisateur a été ajouté avec succès";
}
if ($hruid === null) {
$user = new User();
$add = true;
} else {
$user = new UserFilter(new UFC_Hruid($hruid));
$user = $user->get(true);
if ($user !== false) {
$user->select(UserSelect::tol());
} else {
throw new Exception("Impossible de charger les données de l'utilisateur " . $hruid);
}
}
if (Env::has('add_room') && !$add) {
$r = Room::batchFrom(array(Env::t('rid')));
if ($r->count() == 0) {
$err[] = "La chambre entrée n'existe pas.";
} else {
$user->addRoom($r->pop());
}
}
if (Env::has('del_room') && !$add) {
$r = Room::batchFrom(array(Env::t('rid')));
if ($r->count() == 0) {
$err[] = "La chambre entrée n'existe pas.";
} else {
$user->removeRoom($r->pop());
}
}
if (Env::has('add_perm') && !$add && S::user()->isAdmin()) {
$user->addPerm(Env::t('perm'));
}
if (Env::has('del_perm') && !$add && S::user()->isAdmin()) {
$user->removePerm(Env::t('perm'));
}
if (Env::has('upd_study') && !$add) {
$user->updateStudy(Env::t('formation_id'), Env::t('forlife'), Env::t('year_in'), Env::t('year_out'), Env::t('promo'));
}
if (Env::has('add_study') && !$add) {
$user->addStudy(Env::t('formation_id'), Env::t('year_in'), Env::t('year_out'), Env::t('promo'), Env::t('forlife'));
}
if (Env::has('del_study') && !$add) {
$user->removeStudy(Env::t('formation_id'), Env::t('forlife'));
}
if (Env::has('add_group') && !$add) {
$g = Group::from(Env::t('name'))->select(GroupSelect::castes());
$g->caste(Rights::member())->addUser($user);
}
if (Env::has('del_group') && !$add) {
$g = Group::from(Env::t('name'))->select(GroupSelect::castes());
$g->caste(Rights::member())->removeUser($user);
}
if (Env::has('change_profile')) {
if ($add) {
if (Env::blank('hruid')) {
$hruid = Env::t('firstname') . '.' . Env::t('lastname');
$hruid = strtolower($hruid);
$already = new UserFilter(new UFC_Hruid($hruid));
$nbr = 1;
while ($already->getTotalCount() > 0) {
$nbr++;
$hruid = Env::t('firstname') . '.' . Env::t('lastname') . '.' . $nbr;
$hruid = strtolower($hruid);
$already = new UserFilter(new UFC_Hruid($hruid));
}
} else {
$hruid = Env::t('hruid');
$already = new UserFilter(new UFC_Hruid($hruid));
if ($already->getTotalCount() > 0) {
throw new Exception("Le hruid spécifié est déjà pris.");
}
}
$user->insert();
if (Env::blank('hruid')) {
$user->hruid($hruid);
}
$msg[] = "L'utilisateur a été ajouté.";
}
if (Env::has('image')) {
$group = Group::from('tol')->select(GroupSelect::castes());
$image = new ImageFilter(new PFC_And(new IFC_Id(Env::i('image')), new IFC_Temp()));
$image = $image->get(true);
if (!$image) {
throw new Exception("This image doesn't exist anymore");
}
$image->select(FrankizImageSelect::caste());
$image->label($user->fullName());
$image->caste($group->caste(Rights::everybody()));
$tv = new TolValidate($image, $user);
$v = new Validate(array('writer' => $user, 'group' => $group, 'item' => $tv, 'type' => 'tol'));
$v->insert();
$msg[] = 'La demande de changement de photo tol a été prise en compte.
Les tolmestres essaieront de te la valider au plus tôt.';
//.........这里部分代码省略.........