exp_perms.c 654 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <grass/gis.h>
  2. char *
  3. explain_perms (int group, int other, int will)
  4. {
  5. static char buf[128];
  6. char *who;
  7. char *verb;
  8. char *read;
  9. verb="have";
  10. read="read ";
  11. read=""; /* remove this to have "read" appear */
  12. if (group && other)
  13. {
  14. who = "Everyone";
  15. verb = "has";
  16. }
  17. else if (group)
  18. {
  19. who = "Only users in your group";
  20. }
  21. else if (other)
  22. {
  23. who = "Only users outside your group";
  24. }
  25. else
  26. {
  27. who = "Only you";
  28. read = "";
  29. }
  30. if (will) verb = "have";
  31. sprintf (buf, "%s %s %s %saccess to mapset %s",
  32. who, will?"will":"now", verb, read, G_mapset());
  33. return buf;
  34. }