Gets the Permission instance for read permission on a table.  If caching is enabled the result is either returned
from or added to the cache.
187921
private Permission getReadPermission(String table) {
        return _readPermissionCache != null ?
                _readPermissionCache.getUnchecked(table) :
                createReadPermission(table);
    }
554526
public static String getPermissionsVerbose(int permissions) {
    	StringBuffer buf = new StringBuffer("Allowed:");
    	if ((PdfWriter.ALLOW_PRINTING & permissions) == PdfWriter.ALLOW_PRINTING) buf.append(" Printing");
        if ((PdfWriter.ALLOW_MODIFY_CONTENTS & permissions) == PdfWriter.ALLOW_MODIFY_CONTENTS) buf.append(" Modify contents");
        if ((PdfWriter.ALLOW_COPY & permissions) == PdfWriter.ALLOW_COPY) buf.append(" Copy");
        if ((PdfWriter.ALLOW_MODIFY_ANNOTATIONS & permissions) == PdfWriter.ALLOW_MODIFY_ANNOTATIONS) buf.append(" Modify annotations");
        if ((PdfWriter.ALLOW_FILL_IN & permissions) == PdfWriter.ALLOW_FILL_IN) buf.append(" Fill in");
        if ((PdfWriter.ALLOW_SCREENREADERS & permissions) == PdfWriter.ALLOW_SCREENREADERS) buf.append(" Screen readers");
        if ((PdfWriter.ALLOW_ASSEMBLY & permissions) == PdfWriter.ALLOW_ASSEMBLY) buf.append(" Assembly");
        if ((PdfWriter.ALLOW_DEGRADED_PRINTING & permissions) == PdfWriter.ALLOW_DEGRADED_PRINTING) buf.append(" Degraded printing");
        return buf.toString();
    }
1167089
@Override
    public boolean requestPermissionToRead() {
        boolean rc = false;
        synchronized (this) {
            if ((currentState & READ_NOT_ALLOWED_MASK) == 0) {
                currentState = (currentState | READ_PENDING) & READ_PENDING_CLEAR_OUT;
                rc = true;
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "requestPermissionToRead returning " + rc);
        }
        return rc;
    }
1021250
public static function getByID($paID, PermissionKey $pk, $checkPA = true)
    {
        $app = Application::getFacadeApplication();
        $cache = $app->make('cache/request');
        $identifier = sprintf('permission/access/%s/%s', $pk->getPermissionKeyID(), $paID);
        $item = $cache->getItem($identifier);
        if (!$item->isMiss()) {
            return $item->get();
        }

        $db = $app->make(Connection::class);

        $handle = $pk->getPermissionKeyCategoryHandle();
        if ($pk->permissionKeyHasCustomClass()) {
            $handle = $pk->getPermissionKeyHandle() . '_' . $handle;
        }

        $class = '\\Core\\Permission\\Access\\' . $app->make('helper/text')->camelcase($handle) . 'Access';
        $class = core_class($class, $pk->getPackageHandle());

        $obj = null;
        if ($checkPA) {
            if ($paID) {
                $row = $db->fetchAssoc('select paID, paIsInUse from PermissionAccess where paID = ?', [$paID]);
                if ($row) {
                    $obj = $app->make($class);
                    $obj->setPropertiesFromArray($row);
                }
            }
        } else { // we got here from an assignment object so we already know its in use.
            $obj = $app->make($class);
            $obj->paID = $paID;
            $obj->paIsInUse = true;
        }
        if ($obj !== null) {
            $obj->setPermissionKey($pk);
        }

        $item->set($obj);

        return $obj;
    }
317087
def _permission_trees(permissions):
        """"""
        treecache = PermissionTreeCache()
        cached = treecache.get()
        if not cached:
            tree = PermissionTreeBuilder()
            for permission in permissions:
                tree.insert(permission)
            result = tree.serialize()
            treecache.set(result)
            return result
        return cached
290973
public static function can($permissionName, $params = [], $allowCaching = true)
    {
        if (Podium::getInstance()->userComponent === true) {
            return Podium::getInstance()->user->can($permissionName, $params, $allowCaching);
        }
        if (!Podium::getInstance()->user->isGuest) {
            $user = static::findMe();
            if (empty($user)) {
                return false;
            }
            if ($allowCaching && empty($params) && isset($user->_access[$permissionName])) {
                return $user->_access[$permissionName];
            }
            $access = Podium::getInstance()->rbac->checkAccess($user->id, $permissionName, $params);
            if ($allowCaching && empty($params)) {
                $user->_access[$permissionName] = $access;
            }
            return $access;
        }
        return false;
    }
976896
public static PermissionSet getPermissionSet(final Instance _instance,
                                                 final boolean _evaluate)
        throws EFapsException
    {
        Evaluation.LOG.debug("Retrieving PermissionSet for {}", _instance);
        final Key accessKey = Key.get4Instance(_instance);
        final PermissionSet ret;
        if (AccessCache.getPermissionCache().containsKey(accessKey)) {
            ret = AccessCache.getPermissionCache().get(accessKey);
        } else if (_evaluate) {
            ret = new PermissionSet().setPersonId(accessKey.getPersonId()).setCompanyId(accessKey.getCompanyId())
                            .setTypeId(accessKey.getTypeId());
            Evaluation.eval(ret);
            AccessCache.getPermissionCache().put(accessKey, ret);
        } else {
            ret = null;
        }
        Evaluation.LOG.debug("Retrieved PermissionSet {}", ret);
        return ret;
    }
812892
@SuppressWarnings("unchecked")
    public Permission getPermission(final String name) {
        final Query query = pm.newQuery(Permission.class, "name == :name");
        final List<Permission> result = (List<Permission>) query.execute(name);
        return Collections.isEmpty(result) ? null : result.get(0);
    }
1345371
def get_permissions_mode(permission_octal, name):
    """"""
    read = PERMISSIONS[name]['read']
    write = PERMISSIONS[name]['write']
    execute = PERMISSIONS[name]['execute']

    # Read
    if permission_octal == 4:
        return read & ~write & ~execute

    # Write
    elif permission_octal == 2:
        return ~read & write & ~execute

    # Execute
    elif permission_octal == 1:
        return ~read & ~write & execute

    # Read & Write
    elif permission_octal == 6:
        return read & write & ~execute

    # Read & Execute
    elif permission_octal == 5:
        return read & ~write & execute

    # Write & Execute
    elif permission_octal == 3:
        return ~read & write & execute

    # Read, Write & Execute
    elif permission_octal == 7:
        return read & write & execute

    # No read, write or execute by default
    else:
        return ~read & ~write & ~execute
490147
def single_permission_reader(method_name)
      for permission in joinable_type.constantize.permissions
        if method_name.to_s == "#{permission}_permission"
          return has_permission?(permission)
        end
      end
    
      raise "Unknown single_permission_reader #{method_name.inspect}"
    end
375764
private boolean ownerCanReadTable(String ownerId, String table) {
        return _internalAuthorizer.hasPermissionById(ownerId, getReadPermission(table));
    }
1181835
public java.lang.String getPermission() {
    java.lang.Object ref = permission_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      permission_ = s;
      return s;
    }
  }
944968
def object_permission_set(self):
        ''''''
        return Or(
            AllowOnlySafeHttpMethod,
            AllowAdmin,
            And(
                AllowPermission('org:admin'),
                ObjAttrTrue(lambda _, u: not u.is_superuser),
                ObjAttrTrue(
                    lambda r, _: r.data.get('admin') is not True)
            ),
            And(
                AllowModify,
                ObjAttrTrue(
                    lambda req, user: user == req.user),
                ObjAttrTrue(
                    lambda r, _: r.data.get('admin') is not True)
            ),
        )
625484
def _get_permission_set_tree(user):
    
    if hasattr(user, CACHED_PSET_PROPERTY_KEY):
        return getattr(user, CACHED_PSET_PROPERTY_KEY)
    if user.is_authenticated():
        try:
            return user.permissionset.first().tree()
        except AttributeError:
            raise ObjectDoesNotExist
    return PermissionSet.objects.get(anonymous_user=True).tree()
1183934
def check_permission(instance, field, permission):
    
    if not get_permission_test(instance, field, permission)(instance):
        raise PermissionDeniedError(permission, instance, instance, field)
336427
public function getPermissionAccessObject()
    {
        $app = Application::getFacadeApplication();
        $cache = $app->make('cache/request');
        $identifier = sprintf(
            'permission/assignment/access/%s/%s',
            $this->pk->getPermissionKeyHandle(),
            $this->getPermissionObject()->getPermissionObjectIdentifier()
        );
        $item = $cache->getItem($identifier);
        if (!$item->isMiss()) {
            return $item->get();
        }
        $db = $app->make(Connection::class);
        $r = $db->fetchColumn('select paID from PagePermissionAssignments where cID = ? and pkID = ?', [$this->getPermissionObject()->getPermissionsCollectionID(), $this->pk->getPermissionKeyID()]);
        $pa = $r ? Access::getByID($r, $this->pk, false) : null;
        if ($pa) {
            $permissionObject = $this->getPermissionObject();
            if ($permissionObject->isPageDraft() && $permissionObject->getCollectionInheritance() == 'PARENT' && isset($this->inheritedPageTypeDraftPermissions[$this->pk->getPermissionKeyHandle()])) {
                $pageType = $permissionObject->getPageTypeObject();
                if (is_object($pageType)) {
                    $pk = Key::getByHandle($this->inheritedPageTypeDraftPermissions[$this->pk->getPermissionKeyHandle()]);
                    $pk->setPermissionObject($pageType);
                    $access = $pk->getPermissionAccessObject();
                    if (is_object($access)) {
                        $list_items = $access->getAccessListItems();
                        $pa->setListItems($list_items);
                    }
                }
            }
        }
        $cache->save($item->set($pa));

        return $pa;
    }
1131848
protected function getCachePermissions($cacheKey)
    {
        // Check local cache
        if (isset($this->cachePermissions[$cacheKey])) {
            return $this->cachePermissions[$cacheKey];
        }

        // Check persistent cache
        if ($this->cacheService) {
            $result = $this->cacheService->get($cacheKey);

            // Warm local cache
            if ($result) {
                $this->cachePermissions[$cacheKey] = $result;
                return $result;
            }
        }

        return null;
    }