Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
7621559d
Commit
7621559d
authored
12 years ago
by
Arthur Schiwon
Browse files
Options
Downloads
Patches
Plain Diff
make groups not static, fixes oc-919
parent
80fc0138
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/group/backend.php
+6
-6
6 additions, 6 deletions
lib/group/backend.php
lib/group/database.php
+11
-11
11 additions, 11 deletions
lib/group/database.php
with
17 additions
and
17 deletions
lib/group/backend.php
+
6
−
6
View file @
7621559d
...
...
@@ -44,7 +44,7 @@ abstract class OC_Group_Backend {
OC_GROUP_BACKEND_ADD_TO_GROUP
=>
'addToGroup'
,
OC_GROUP_BACKEND_REMOVE_FROM_GOUP
=>
'removeFromGroup'
,
);
/**
* @brief Get all supported actions
* @returns bitwise-or'ed actions
...
...
@@ -62,7 +62,7 @@ abstract class OC_Group_Backend {
return
$actions
;
}
/**
* @brief Check if backend implements actions
* @param $actions bitwise-or'ed actions
...
...
@@ -83,7 +83,7 @@ abstract class OC_Group_Backend {
*
* Checks whether the user is member of a group or not.
*/
public
static
function
inGroup
(
$uid
,
$gid
){
public
function
inGroup
(
$uid
,
$gid
){
return
in_array
(
$gid
,
$this
->
getUserGroups
(
$uid
));
}
...
...
@@ -95,7 +95,7 @@ abstract class OC_Group_Backend {
* This function fetches all groups a user belongs to. It does not check
* if the user exists at all.
*/
public
static
function
getUserGroups
(
$uid
){
public
function
getUserGroups
(
$uid
){
return
array
();
}
...
...
@@ -105,7 +105,7 @@ abstract class OC_Group_Backend {
*
* Returns a list with all groups
*/
public
static
function
getGroups
(){
public
function
getGroups
(){
return
array
();
}
...
...
@@ -122,7 +122,7 @@ abstract class OC_Group_Backend {
* @brief get a list of all users in a group
* @returns array with user ids
*/
public
static
function
usersInGroup
(
$gid
){
public
function
usersInGroup
(
$gid
){
return
array
();
}
...
...
This diff is collapsed.
Click to expand it.
lib/group/database.php
+
11
−
11
View file @
7621559d
...
...
@@ -41,7 +41,7 @@
* Class for group management in a SQL Database (e.g. MySQL, SQLite)
*/
class
OC_Group_Database
extends
OC_Group_Backend
{
static
private
$userGroupCache
=
array
();
private
$userGroupCache
=
array
();
/**
* @brief Try to create a new group
...
...
@@ -51,7 +51,7 @@ class OC_Group_Database extends OC_Group_Backend {
* Trys to create a new group. If the group name already exists, false will
* be returned.
*/
public
static
function
createGroup
(
$gid
){
public
function
createGroup
(
$gid
){
// Check for existence
$query
=
OC_DB
::
prepare
(
"SELECT gid FROM `*PREFIX*groups` WHERE gid = ?"
);
$result
=
$query
->
execute
(
array
(
$gid
));
...
...
@@ -76,7 +76,7 @@ class OC_Group_Database extends OC_Group_Backend {
*
* Deletes a group and removes it from the group_user-table
*/
public
static
function
deleteGroup
(
$gid
){
public
function
deleteGroup
(
$gid
){
// Delete the group
$query
=
OC_DB
::
prepare
(
"DELETE FROM `*PREFIX*groups` WHERE gid = ?"
);
$result
=
$query
->
execute
(
array
(
$gid
));
...
...
@@ -96,7 +96,7 @@ class OC_Group_Database extends OC_Group_Backend {
*
* Checks whether the user is member of a group or not.
*/
public
static
function
inGroup
(
$uid
,
$gid
){
public
function
inGroup
(
$uid
,
$gid
){
// check
$query
=
OC_DB
::
prepare
(
"SELECT uid FROM `*PREFIX*group_user` WHERE gid = ? AND uid = ?"
);
$result
=
$query
->
execute
(
array
(
$gid
,
$uid
));
...
...
@@ -112,9 +112,9 @@ class OC_Group_Database extends OC_Group_Backend {
*
* Adds a user to a group.
*/
public
static
function
addToGroup
(
$uid
,
$gid
){
public
function
addToGroup
(
$uid
,
$gid
){
// No duplicate entries!
if
(
!
self
::
inGroup
(
$uid
,
$gid
)){
if
(
!
$this
->
inGroup
(
$uid
,
$gid
)){
$query
=
OC_DB
::
prepare
(
"INSERT INTO `*PREFIX*group_user` ( `uid`, `gid` ) VALUES( ?, ? )"
);
$result
=
$query
->
execute
(
array
(
$uid
,
$gid
));
return
true
;
...
...
@@ -131,7 +131,7 @@ class OC_Group_Database extends OC_Group_Backend {
*
* removes the user from a group.
*/
public
static
function
removeFromGroup
(
$uid
,
$gid
){
public
function
removeFromGroup
(
$uid
,
$gid
){
$query
=
OC_DB
::
prepare
(
"DELETE FROM *PREFIX*group_user WHERE uid = ? AND gid = ?"
);
$result
=
$query
->
execute
(
array
(
$uid
,
$gid
));
...
...
@@ -146,7 +146,7 @@ class OC_Group_Database extends OC_Group_Backend {
* This function fetches all groups a user belongs to. It does not check
* if the user exists at all.
*/
public
static
function
getUserGroups
(
$uid
){
public
function
getUserGroups
(
$uid
){
// No magic!
$query
=
OC_DB
::
prepare
(
"SELECT gid FROM `*PREFIX*group_user` WHERE uid = ?"
);
$result
=
$query
->
execute
(
array
(
$uid
));
...
...
@@ -165,7 +165,7 @@ class OC_Group_Database extends OC_Group_Backend {
*
* Returns a list with all groups
*/
public
static
function
getGroups
(){
public
function
getGroups
(){
$query
=
OC_DB
::
prepare
(
"SELECT gid FROM `*PREFIX*groups`"
);
$result
=
$query
->
execute
();
...
...
@@ -176,12 +176,12 @@ class OC_Group_Database extends OC_Group_Backend {
return
$groups
;
}
/**
* @brief get a list of all users in a group
* @returns array with user ids
*/
public
static
function
usersInGroup
(
$gid
){
public
function
usersInGroup
(
$gid
){
$query
=
OC_DB
::
prepare
(
'SELECT uid FROM *PREFIX*group_user WHERE gid=?'
);
$users
=
array
();
$result
=
$query
->
execute
(
array
(
$gid
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment