Esempio n. 1
0
                    $sourceStr = explode('#', $df['configdefault']);
                    sort($sourceStr);
                    $sourceStr = implode('#', $sourceStr);
                    if ($sourceStr != $currentStr) {
                        $this->dbObj->Execute('INSERT INTO ' . WEB_ADMIN_TABPOX . 'attachrule(userorgrouporrole,userorgrouporroleid,addordel,ruleid,otherruleid,configvalue,importer)' . "values(3,{$id},1,{$k},{$ink},'{$currentStr}'," . $this->getUid() . ')');
                    }
                }
            }
        }
        //所在组
        if (isset($_POST['groups'])) {
            foreach ($_POST['groups'] as $v) {
                $this->dbObj->Execute('INSERT INTO ' . WEB_ADMIN_TABPOX . "grouprole(groupid,roleid,importer)VALUES({$v},{$id}," . $this->getUid() . ')');
            }
        }
        if ($this->isModify) {
            $this->dbObj->Execute("update " . WEB_ADMIN_TABPOX . "login set updatestate = 1 where userid in(\r\n\t\t\t\tselect ug.userid from " . WEB_ADMIN_TABPOX . "usergroup ug \r\n\t\t\t\tinner join " . WEB_ADMIN_TABPOX . "grouprole gr on ug.groupid = gr.groupid where gr.roleid = {$id})");
        }
        $this->quit($info . '完成!');
    }
    function goModify()
    {
        $this->goAppend();
    }
    function quit($info)
    {
        exit("<script>alert('{$info}');location.href='role.php';</script>");
    }
}
$main = new PageRole();
$main->Main();
 /**
  * Remove the given Role from the given Page only if it (or it's parents) doesn't already remove the Role
  *
  * A call to save() should eventually follow, which will save to disk
  *
  * @param Role $role
  * @param Page $page
  * @return this
  *
  */
 public function removeRoleFromPage(Role $role, Page $page)
 {
     if ($this->pageDoesNotHaveRole($page, $role)) {
         return $this;
     }
     $pageRole = $this->pagesRolesArray->getPageRole($page, $role);
     if (!$pageRole) {
         $pageRole = new PageRole();
     }
     $pageRole->setTrackChanges();
     $pageRole->page = $page;
     $pageRole->role = $role;
     $pageRole->action = '-';
     //if(!$page->parent || $this->pageHasRole($page->parent, $role)) $pageRole->redundant = true;
     $this->pagesRolesArray->add($pageRole);
     // we trackChange with the $page since PageRoles are saved by Pages::save
     if ($role->id != Role::ownerRoleID) {
         $page->trackChange("roles");
     }
     return $this;
 }