diff options
author | Jacek Antonelli | 2009-09-27 21:08:27 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-09-27 21:08:27 -0500 |
commit | 123cc9f638fe3617a12f24a543639d4ca3f72264 (patch) | |
tree | 905e58ed32a35258334597f991c37fef54c184cb /linden/indra/newview | |
parent | Updated Imprudence version to "1.2.0 beta". (diff) | |
download | meta-impy-123cc9f638fe3617a12f24a543639d4ca3f72264.zip meta-impy-123cc9f638fe3617a12f24a543639d4ca3f72264.tar.gz meta-impy-123cc9f638fe3617a12f24a543639d4ca3f72264.tar.bz2 meta-impy-123cc9f638fe3617a12f24a543639d4ca3f72264.tar.xz |
"Fixed and cleaned up the export permissions check."
Diffstat (limited to 'linden/indra/newview')
-rw-r--r-- | linden/indra/newview/llviewermenu.cpp | 54 | ||||
-rw-r--r-- | linden/indra/newview/primbackup.cpp | 107 | ||||
-rw-r--r-- | linden/indra/newview/primbackup.h | 2 |
3 files changed, 71 insertions, 92 deletions
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index 0146f9e..ba24c16 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp | |||
@@ -2307,56 +2307,32 @@ class LLObjectEnableExport : public view_listener_t | |||
2307 | { | 2307 | { |
2308 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | 2308 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) |
2309 | { | 2309 | { |
2310 | LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); | 2310 | LLControlVariable* control = |
2311 | bool new_value = (object != NULL); | 2311 | gMenuHolder->findControl(userdata["control"].asString()); |
2312 | if (new_value) | 2312 | |
2313 | { | 2313 | LLViewerObject* object = |
2314 | LLVOAvatar* avatar = find_avatar_from_object(object); | 2314 | LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); |
2315 | new_value = (avatar == NULL); | 2315 | |
2316 | } | 2316 | if((object != NULL) && |
2317 | if(new_value) | 2317 | (find_avatar_from_object(object) == NULL)) |
2318 | { | 2318 | { |
2319 | |||
2320 | struct ff : public LLSelectedNodeFunctor | 2319 | struct ff : public LLSelectedNodeFunctor |
2321 | { | 2320 | { |
2322 | ff(const LLSD& data) : LLSelectedNodeFunctor() | ||
2323 | ,userdata(data) | ||
2324 | { | ||
2325 | |||
2326 | } | ||
2327 | const LLSD& userdata; | ||
2328 | virtual bool apply(LLSelectNode* node) | 2321 | virtual bool apply(LLSelectNode* node) |
2329 | { | 2322 | { |
2330 | if(gAgent.getID()!=node->mPermissions->getCreator()) | 2323 | return primbackup::check_perms( node ); |
2331 | { | ||
2332 | return false; | ||
2333 | } | ||
2334 | return true; | ||
2335 | } | 2324 | } |
2336 | }; | 2325 | } func; |
2337 | 2326 | ||
2338 | #ifdef LL_GRID_PERMISSIONS | 2327 | if(LLSelectMgr::getInstance()->getSelection()->applyToNodes(&func,false)) |
2339 | |||
2340 | ff * the_ff=new ff(userdata); | ||
2341 | if(LLSelectMgr::getInstance()->getSelection()->applyToNodes(the_ff,false)) | ||
2342 | { | ||
2343 | gMenuHolder->findControl(userdata["control"].asString())->setValue(true); | ||
2344 | } | ||
2345 | else | ||
2346 | { | 2328 | { |
2347 | gMenuHolder->findControl(userdata["control"].asString())->setValue(false); | 2329 | control->setValue(true); |
2330 | return true; | ||
2348 | } | 2331 | } |
2349 | return true; | ||
2350 | } | 2332 | } |
2351 | 2333 | ||
2352 | gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); | 2334 | control->setValue(false); |
2353 | return true; | ||
2354 | #else | ||
2355 | } | ||
2356 | gMenuHolder->findControl(userdata["control"].asString())->setValue(true); | ||
2357 | return true; | 2335 | return true; |
2358 | #endif | ||
2359 | |||
2360 | } | 2336 | } |
2361 | }; | 2337 | }; |
2362 | 2338 | ||
diff --git a/linden/indra/newview/primbackup.cpp b/linden/indra/newview/primbackup.cpp index 78fd482..8dbf1df 100644 --- a/linden/indra/newview/primbackup.cpp +++ b/linden/indra/newview/primbackup.cpp | |||
@@ -350,54 +350,52 @@ void primbackup::pre_export_object() | |||
350 | gIdleCallbacks.addFunction(exportworker, NULL); | 350 | gIdleCallbacks.addFunction(exportworker, NULL); |
351 | } | 351 | } |
352 | 352 | ||
353 | |||
354 | // static | ||
355 | bool primbackup::check_perms( LLSelectNode* node ) | ||
356 | { | ||
357 | LLPermissions *perms = node->mPermissions; | ||
358 | return (gAgent.getID() == perms->getOwner() && | ||
359 | gAgent.getID() == perms->getCreator() && | ||
360 | (PERM_ITEM_UNRESTRICTED & | ||
361 | perms->getMaskOwner()) == PERM_ITEM_UNRESTRICTED); | ||
362 | } | ||
363 | |||
364 | |||
353 | void primbackup::exportworker(void *userdata) | 365 | void primbackup::exportworker(void *userdata) |
354 | { | 366 | { |
355 | primbackup::getInstance()->updateexportnumbers(); | 367 | primbackup::getInstance()->updateexportnumbers(); |
356 | 368 | ||
357 | switch(primbackup::getInstance()->export_state) | 369 | switch(primbackup::getInstance()->export_state) |
358 | { | 370 | { |
359 | case EXPORT_INIT: | 371 | case EXPORT_INIT: { |
372 | primbackup::getInstance()->show(); | ||
373 | LLSelectMgr::getInstance()->getSelection()->ref(); | ||
374 | |||
375 | struct ff : public LLSelectedNodeFunctor | ||
360 | { | 376 | { |
361 | primbackup::getInstance()->show(); | 377 | virtual bool apply(LLSelectNode* node) |
362 | LLSelectMgr::getInstance()->getSelection()->ref(); | ||
363 | |||
364 | struct ff : public LLSelectedNodeFunctor | ||
365 | { | ||
366 | virtual bool apply(LLSelectNode* node) | ||
367 | { | ||
368 | if(gAgent.getID()!=node->mPermissions->getOwner()) | ||
369 | { | ||
370 | #ifdef LL_GRID_PERMISSIONS | ||
371 | return false; | ||
372 | #else | ||
373 | return true; | ||
374 | #endif | ||
375 | } | ||
376 | else if(581632==node->mPermissions->getMaskOwner() || 2147483647==node->mPermissions->getMaskOwner()) | ||
377 | { | ||
378 | return true; | ||
379 | } | ||
380 | return false; | ||
381 | } | ||
382 | } func; | ||
383 | |||
384 | if(LLSelectMgr::getInstance()->getSelection()->applyToNodes(&func,false)) | ||
385 | primbackup::getInstance()->export_state=EXPORT_STRUCTURE; | ||
386 | else | ||
387 | { | 378 | { |
388 | llwarns<<"Incorrect permission to export"<<llendl; | 379 | return primbackup::check_perms( node ); |
389 | primbackup::getInstance()->export_state=EXPORT_DONE; | ||
390 | primbackup::getInstance()->close(); | ||
391 | gIdleCallbacks.deleteFunction(exportworker); | ||
392 | LLSelectMgr::getInstance()->getSelection()->unref(); | ||
393 | |||
394 | } | 380 | } |
395 | break; | 381 | } func; |
396 | } | ||
397 | 382 | ||
383 | if(LLSelectMgr::getInstance()->getSelection()->applyToNodes(&func,false)) | ||
384 | { | ||
385 | primbackup::getInstance()->export_state=EXPORT_STRUCTURE; | ||
386 | } | ||
387 | else | ||
388 | { | ||
389 | llwarns << "Incorrect permission to export" << llendl; | ||
390 | primbackup::getInstance()->export_state=EXPORT_DONE; | ||
391 | primbackup::getInstance()->close(); | ||
392 | gIdleCallbacks.deleteFunction(exportworker); | ||
393 | LLSelectMgr::getInstance()->getSelection()->unref(); | ||
394 | } | ||
398 | break; | 395 | break; |
399 | case EXPORT_STRUCTURE: | 396 | } |
400 | { | 397 | |
398 | case EXPORT_STRUCTURE: { | ||
401 | struct ff : public LLSelectedObjectFunctor | 399 | struct ff : public LLSelectedObjectFunctor |
402 | { | 400 | { |
403 | virtual bool apply(LLViewerObject* object) | 401 | virtual bool apply(LLViewerObject* object) |
@@ -405,7 +403,7 @@ void primbackup::exportworker(void *userdata) | |||
405 | object->boostTexturePriority(TRUE); | 403 | object->boostTexturePriority(TRUE); |
406 | LLViewerObject::child_list_t children = object->getChildren(); | 404 | LLViewerObject::child_list_t children = object->getChildren(); |
407 | children.push_front(object); //push root onto list | 405 | children.push_front(object); //push root onto list |
408 | LLSD prim_llsd=primbackup::getInstance()->prims_to_llsd(children); | 406 | LLSD prim_llsd=primbackup::getInstance()->prims_to_llsd(children); |
409 | LLSD stuff; | 407 | LLSD stuff; |
410 | stuff["root_position"] = object->getPosition().getValue(); | 408 | stuff["root_position"] = object->getPosition().getValue(); |
411 | stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotation()); | 409 | stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotation()); |
@@ -421,7 +419,8 @@ void primbackup::exportworker(void *userdata) | |||
421 | 419 | ||
422 | break; | 420 | break; |
423 | } | 421 | } |
424 | case EXPORT_TEXTURES: | 422 | |
423 | case EXPORT_TEXTURES: { | ||
425 | if(primbackup::getInstance()->m_nexttextureready==false) | 424 | if(primbackup::getInstance()->m_nexttextureready==false) |
426 | return; | 425 | return; |
427 | 426 | ||
@@ -435,23 +434,25 @@ void primbackup::exportworker(void *userdata) | |||
435 | } | 434 | } |
436 | 435 | ||
437 | primbackup::getInstance()->export_next_texture(); | 436 | primbackup::getInstance()->export_next_texture(); |
438 | break; | 437 | break; |
438 | } | ||
439 | 439 | ||
440 | case EXPORT_LLSD: | 440 | case EXPORT_LLSD: { |
441 | { | 441 | // Create a file stream and write to it |
442 | // Create a file stream and write to it | 442 | llofstream export_file(primbackup::getInstance()->file_name); |
443 | llofstream export_file(primbackup::getInstance()->file_name); | 443 | LLSDSerialize::toPrettyXML(primbackup::getInstance()->llsd, export_file); |
444 | LLSDSerialize::toPrettyXML(primbackup::getInstance()->llsd, export_file); | 444 | export_file.close(); |
445 | export_file.close(); | 445 | primbackup::getInstance()->m_nexttextureready=true; |
446 | primbackup::getInstance()->m_nexttextureready=true; | 446 | primbackup::getInstance()->export_state=EXPORT_TEXTURES; |
447 | primbackup::getInstance()->export_state=EXPORT_TEXTURES; | ||
448 | } | ||
449 | break; | 447 | break; |
450 | case EXPORT_DONE: | 448 | } |
451 | llinfos<<"Backup complete"<<llendl | 449 | |
452 | gIdleCallbacks.deleteFunction(exportworker); | 450 | case EXPORT_DONE: { |
453 | primbackup::getInstance()->close(); | 451 | llinfos << "Backup complete" << llendl; |
452 | gIdleCallbacks.deleteFunction(exportworker); | ||
453 | primbackup::getInstance()->close(); | ||
454 | break; | 454 | break; |
455 | } | ||
455 | } | 456 | } |
456 | } | 457 | } |
457 | 458 | ||
diff --git a/linden/indra/newview/primbackup.h b/linden/indra/newview/primbackup.h index fddc35f..cbd757a 100644 --- a/linden/indra/newview/primbackup.h +++ b/linden/indra/newview/primbackup.h | |||
@@ -18,6 +18,8 @@ class primbackup : public LLFloater | |||
18 | //Static accessor | 18 | //Static accessor |
19 | static primbackup* getInstance(); | 19 | static primbackup* getInstance(); |
20 | 20 | ||
21 | static bool check_perms( LLSelectNode* node ); | ||
22 | |||
21 | virtual ~primbackup(); | 23 | virtual ~primbackup(); |
22 | 24 | ||
23 | //Floater stuff | 25 | //Floater stuff |