本文整理汇总了PHP中Access::acl_check方法的典型用法代码示例。如果您正苦于以下问题:PHP Access::acl_check方法的具体用法?PHP Access::acl_check怎么用?PHP Access::acl_check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Access
的用法示例。
在下文中一共展示了Access::acl_check方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeModule
function initializeModule($request_method, $request_data)
{
if (empty($this->shared_data['group_info'])) {
return 'skip';
}
$this->gid = $this->shared_data['group_info']->collection_id;
$this->shared_data['member_type'] = $member_type = Group::get_user_type(PA::$login_uid, (int) $this->gid);
$this->is_member = $member_type == MEMBER ? TRUE : FALSE;
if ($member_type == OWNER) {
$this->is_member = TRUE;
$this->is_admin = TRUE;
}
$acl = new Access();
// check for moderation of group permissions
$gp_access = $acl->acl_check('action', 'edit', 'users', $member_type, 'group', 'all');
if (PA::$login_uid == SUPER_USER_ID || $member_type == 'moderator') {
$gp_access = 1;
}
$this->is_admin = $this->shared_data['moderation_permissions'] = $gp_access;
$this->group_details = $this->shared_data['group_info'];
if (!$this->is_member) {
if ((!empty($this->group_details) ? $this->group_details->reg_type : NULL) && $this->group_details->reg_type == REG_MODERATED) {
$this->join_this_group_string = __('Request to join this family as');
} else {
$this->join_this_group_string = __('Join This family as');
}
} else {
// get the relationType for this user
list($relType, $relLabel) = TypedGroupEntityRelation::get_relation_to_group(PA::$login_uid, (int) $this->gid);
if (empty($relType)) {
$relType = 'member';
$relLabel = __('Member');
}
$this->relationType = $relType;
$this->relationTypeString = sprintf(__("You are a %s"), $relLabel);
}
$this->availTypes = TypedGroupEntity::get_avail_types();
$this->selectTypes = array();
foreach ($this->availTypes as $k => $l) {
$this->selectTypes[] = array('label' => $l, 'value' => $k);
}
// Do we already have a bound Entity?
// we need to load the generic parent class, as we do noot yet know the type
if ($typedEntity = TypedGroupEntity::load_for_group($this->gid)) {
$this->entity = $typedEntity;
// get info about what profile fields this has
$type = $this->entity->entity_type;
$classname = ucfirst($type) . "TypedGroupEntity";
@(include_once "api/Entity/{$classname}.php");
if (class_exists($classname)) {
$instance = new $classname();
} else {
// just get default
$instance = new TypedGroupEntity();
}
$this->profilefields = $instance->get_profile_fields();
$this->availRelations = $instance->get_avail_relations();
$this->selectRelations = array();
foreach ($this->availRelations as $k => $l) {
$this->selectRelations[] = array('label' => $l, 'value' => $k);
}
// does the admin want to edit it?
if ($this->shared_data['moderation_permissions'] && !empty($request_data['edit_enityprofile'])) {
$this->title = sprintf(__("Edit %s profile"), $typedEntity->attributes['name']['value']);
$this->inner_template = PA::$blockmodule_path . '/' . get_class($this) . "/edit_typedgroup_profile.tpl.php";
// load into form
$this->dynFields = new DynamicFormFields($this->entity->attributes);
} else {
// display only
$this->title = sprintf(__("%s profile"), $typedEntity->attributes['name']['value']);
$this->inner_template = PA::$blockmodule_path . '/' . get_class($this) . "/typedgroup_profile.tpl.php";
}
} else {
return 'skip';
/*
// moderators only
if(!$this->shared_data['moderation_permissions']) {
return 'skip';
}
*/
}
switch ($this->column) {
case 'middle':
break;
case 'left':
case 'right':
default:
break;
}
}
示例2: Access
break;
default:
$msg1 = "";
}
}
if (!empty($show_options)) {
$header->show_options = TRUE;
}
/* Loading The Group Details */
$gid = (int) $_REQUEST['gid'];
// lets see if the user has permissions for this page
$user_type = Group::get_user_type($_SESSION['user']['id'], $_REQUEST['gid']);
$acl = new Access();
//check for moderation of group
// its for owner later we can define permissions for moderators
$gp_access = $acl->acl_check('action', 'edit', 'users', $user_type, 'group', 'all');
if ($_SESSION['user']['id'] == SUPER_USER_ID) {
$gp_access = 1;
}
if (!$gp_access) {
$permission_denied_msg = "Sorry you are not authorised to moderate this group";
}
// Delting the Member from the Group:Starts
if (!empty($_POST["members"]) && !empty($_POST["group_id"])) {
$membersArr = array();
$membersArr = $_POST["members"];
$Group = new Group();
$Group->collection_id = $_POST["group_id"];
for ($counter = 0; $counter < count($membersArr); $counter++) {
$Group->leave((int) $membersArr[$counter]);
}