Code Duplication    Length = 9-11 lines in 4 locations

auth/DbAcl.php 1 location

@@ 173-182 (lines=10) @@
170
     * @return array
171
     * @throws \Micro\Base\Exception
172
     */
173
    protected function rolePerms($role)
174
    {
175
        $query = new Query($this->db);
176
        $query->select = '*';
177
        $query->table = 'acl_role_perm';
178
        $query->addWhere('role='.$role);
179
        $query->single = false;
180
181
        return $query->run();
182
    }
183
184
    /**
185
     * Assign role permission

auth/FileAcl.php 1 location

@@ 94-103 (lines=10) @@
91
     * @return mixed
92
     * @throws \Micro\Base\Exception
93
     */
94
    public function assigned($userId)
95
    {
96
        $query = new Query($this->db);
97
        $query->select = '*';
98
        $query->table = 'acl_user';
99
        $query->addWhere('`user`='.$userId);
100
        $query->single = false;
101
102
        return $query->run();
103
    }
104
105
    /**
106
     * Get permissions in role

auth/Rbac.php 1 location

@@ 150-160 (lines=11) @@
147
     * @return mixed
148
     * @throws \Micro\Base\Exception
149
     */
150
    public function assigned($userId)
151
    {
152
        $query = new Query($this->db);
153
        $query->distinct = true;
154
        $query->select = '`role` AS `name`';
155
        $query->table = '`rbac_user`';
156
        $query->addWhere('`user`='.$userId);
157
        $query->single = false;
158
159
        return $query->run(\PDO::FETCH_ASSOC);
160
    }
161
162
    /**
163
     * Recursive search in roles array

auth/DbRbac.php 1 location

@@ 149-157 (lines=9) @@
146
     * @return mixed
147
     * @throws \Micro\Base\Exception
148
     */
149
    public function rawRoles($pdo = \PDO::FETCH_ASSOC)
150
    {
151
        $query = new Query($this->db);
152
        $query->table = 'rbac_role';
153
        $query->order = '`type` ASC';
154
        $query->single = false;
155
156
        return $query->run($pdo);
157
    }
158
159
    /**
160
     * Recursive delete roles from array