| | 301 | function community_permissions_check($object_type, $object_owner) { |
|---|
| | 302 | $result = null; |
|---|
| | 303 | |
|---|
| | 304 | switch ($object_type) { |
|---|
| | 305 | case 'files': |
|---|
| | 306 | // members have access to upload files or create directories |
|---|
| | 307 | if (run('community:membership:check', array($_SESSION['userid'], $object_owner))) { |
|---|
| | 308 | return true; |
|---|
| | 309 | } |
|---|
| | 310 | break; |
|---|
| | 311 | case 'files:edit': |
|---|
| | 312 | // community owner can edit all files |
|---|
| | 313 | if (record_exists('users', 'ident', $object_owner, 'owner', $_SESSION['userid'])) { |
|---|
| | 314 | return true; |
|---|
| | 315 | } |
|---|
| | 316 | break; |
|---|
| | 317 | |
|---|
| | 318 | } |
|---|
| | 319 | |
|---|
| | 320 | return $result; |
|---|
| | 321 | } |
|---|
| | 322 | |
|---|